Hi everyone,

I am starting my first mySQL project .

I want to create 2 tables

Table User :  userId , FisrtName, LastNAme, Gender   with userId defined as
the primary key that auto-increments

I want that each time I insert a new row in this table, the field "userId" is
inserted as well in another table named Results

Table Results : userId, Category, ResponseText, ....

I read carefully the mySQL tutorial and tried to define userId field when
creating Table Results    as follows :
  "userId  smallint not null referenced user ".  I tried to use then the
function last_insert_id  to insert new rows in Table Results
but it didn't work . I always get "0" in the userId  field of TableResult.

Thank you very much in advance for your help !




---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to