|
|
||||||
|
||||||
| Index Link To US Private Messages Archive FAQ RSS | ||||||
| Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome. |
Share Thread: & Tags
|
||||
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Hi!
I want to insert data into two tables in one mysql query. First one would store user account details in TBL_USERS then i want on successful insertion of the primary a new record to be inserted at the same time into another table containing addresses TBL_USERS_DATA with just the username and time stamp (they will be able to add more details later on). Is this the best solution? I would like to keep login accounts/details separated from addresses thereby speed up queries etc. function addNewUser($username, $password, $email){ $time = time(); /* If admin sign up, give admin user level */ if(strcasecmp($username, ADMIN_NAME) == 0){ $ulevel = ADMIN_LEVEL; }else{ $ulevel = USER_LEVEL; } $q = "INSERT INTO ".TBL_USERS." VALUES ('$username', '$password', '0', $ulevel, '$email', $time)"; return mysql_query($q, $this->connection) } This is what i want to be inserted simultaneously : $x = "INSERT INTO ".TBL_USERS_DATA." (username, timestamp) VALUES ('$username', $time)"; I have found some info at Learning Journal - Inserting Data in Multiple Tables about using mysql_insert_id() function but not sure how to implement it into mine. Thanks for all help. |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Need php/mySQL solution for multiple domains | spiderbait | Web Programming Discussion Forum | 2 | 01-17-2006 11:05 PM |
| Table layout using php/mysql to extract golf statistics | daddyg | Web Programming Discussion Forum | 8 | 08-18-2005 02:43 AM |
| CSS Table List - PHP mySQL | richkoi | Graphics & Design Discussion Forum | 4 | 06-06-2005 04:09 AM |
| PHP MySQL Multiple Column Dynamic Dropdown | Chris W.P. | Web Programming Discussion Forum | 0 | 08-19-2004 01:34 PM |
| [PHPmySQL] How? Make sortable table format of mySQL database | MasterT | Database Discussion Forum | 1 | 06-08-2004 11:35 PM |
|
WebProWorld |
Advertise |
Contact Us |
About |
Forum Rules |
MVP's |
Archive |
Newsletter Archive |
Top |
WebProNews
WebProWorld is an iEntry, Inc. ® site - © 2009 All Rights Reserved Privacy Policy and Legal iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509 |