Yaniv, Set the field of user_id to INT then make the size 10 or larger, which will produce an ID size of up to 9999999999. Now set it to auto increment then set the user_id field to Primary key, this should solve your problem, if I understand you correctly
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 12, 2002 11:02 AM To: [EMAIL PROTECTED] Subject: simple question on joining tables 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 --------------------------------------------------------------------- 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