A2xA Posted August 31, 2008 Share Posted August 31, 2008 I'm integrating my 2 user systems and I need a table updated so whenever someone registers and I get an entry into the forum user table it also enters into the user table. Is this possible? My 2 tables are in the same database. Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted August 31, 2008 Share Posted August 31, 2008 You could just do 2 insert queries? http://dev.mysql.com/doc/refman/5.0/en/insert.html the syntax for an insert query also suggest you can insert into 2 tables so long as you properly call each field to be inserted by not being too ambiguous Quote Link to comment Share on other sites More sharing options...
A2xA Posted August 31, 2008 Author Share Posted August 31, 2008 I've tried this and I couldn't get it to work so I was seeing if I could just do this. Cause the forum software I'm using is smf and the registration script is very complicated through different php files. I'll try and mess with it some more though. The code I was trying to use: <?php $name = $_POST['x']; $user = $_POST['x']; $pass = $_POST['x']; $pass_c = $_POST['x']; $email = $_POST['xl']; // Insert user into the database $query = 'INSERT INTO users (userName, userUser, userPass, userEmail) VALUES ("' . $name . '", "' . $user . '", "' . md5($pass) . '", "' . $email . '")'; mysql_query($query, $link); ?> Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted August 31, 2008 Share Posted August 31, 2008 well u inserting into 1 table (users) so read the syntax and try and do 2 tables. Quote Link to comment Share on other sites More sharing options...
A2xA Posted August 31, 2008 Author Share Posted August 31, 2008 I know I mean I'm trying to insert that code into my forum's registration code and I couldn't figure it out. I was just seeing if that was possible I'll play around with it some more. Thanks for the help. Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted August 31, 2008 Share Posted August 31, 2008 if the query don't work and u don't know why error check it <?php $name = $_POST['x']; $user = $_POST['x']; $pass = $_POST['x']; $pass_c = $_POST['x']; $email = $_POST['xl']; // Insert user into the database $query = 'INSERT INTO users (userName, userUser, userPass, userEmail) VALUES ("' . $name . '", "' . $user . '", "' . md5($pass) . '", "' . $email . '")'; mysql_query($query, $link) or die(mysql_error()."<br /><br />\n\n".$query); ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.