Jump to content


This topic is now archived and is closed to further replies.


Inserting records problem!!

Recommended Posts

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...



$db = mysql_connect(\"localhost\", \"jamieguthrie\", \"******\")


die(\"could not connect\");





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.

Share this post

Link to post
Share on other sites

..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.

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.