Jump to content

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

 

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

Link to comment
https://forums.phpfreaks.com/topic/65-inserting-records-problem/
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.

Link to comment
https://forums.phpfreaks.com/topic/65-inserting-records-problem/#findComment-175
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.