seegy87 Posted January 18, 2003 Share Posted January 18, 2003 The case is this... I am setting up a new site that will contain many different tabs. It will have the ability to sign up and post your own tablatures, so therefore it needs a way to add a record for everytime someone signs up etc. So i made a page called signupprocess.php or something and put at the top my connection details and a query with INSERT INTO (i\'ll post the whole thing further down...) Well, it didn\'t work, so i had an idea! I added a record using phpMyAdmin, and copied the code that it churned up (the confirmation bit thingy). I then deleted the old record so that it wouldn\'t try to overwrite the old thing and cause a problem. I then slapped that code into my php page and it didn\'t work :x I was wondering if anyone could help me... here is my code... <?php $db = mysql_connect(\"localhost\", \"jamieguthrie\", \"******\") or die(\"could not connect\"); mysql_select_db(\"jamieguthrie_uk_db\",$db); ?> <?php INSERT INTO `user` (`userid`, `forename`, `surname`, `fav_tabs`, `fav_quote`) VALUES (\'\', \'Jamie\', \'Guthrie\', \'GreenDay\', \'howdy\'); ?> (that insert bit is exactly what came out of phpMyAdmin) That is what i have basically. The database is called jamieguthrie_uk_db, my username is jamieguthrie, my password is ******, the table i want to add to is called user, there are 5 rows (you can see them in the coding) Please help, as i don\'t know what i have done wrong :? P.S. that \'\' before the \'Jamie\' bit in the VALUES bit is a double \'. It is the id set to autoincrement so it hasn\'t been filled in. Quote Link to comment https://forums.phpfreaks.com/topic/65-inserting-records-problem/ Share on other sites More sharing options...
metalblend Posted January 18, 2003 Share Posted January 18, 2003 ..just as I replied in the PHP Help forum, you need to use PHP\'s mysql_query(). mysql_query("INSERT INTO `user` (`userid`, `forename`, `surname`, `fav_tabs`, `fav_quote`) VALUES (\'\', \'Jamie\', \'Guthrie\', \'GreenDay\', \'howdy\')",$db); Hope that helps. Quote Link to comment https://forums.phpfreaks.com/topic/65-inserting-records-problem/#findComment-175 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.