Jump to content

Recommended Posts

Posted

I'm having trouble inserting into my database from my php page. I can connect to the db and select from the db. I've tried deleting the table and creating it again.

 

Nothing is working. Please help.

Posted

Can you show what your script is doing?

Can you tell us what the error is?

 

I'm not a SQL expert, so I can't help, but I doubt anyone can with the info you've given...

Posted

This is how i do it.

 

connecting to database.

>$db = mysql_connect(localhost, $db_username, $db_password);
mysql_select_db($db_name);

then to insert

>$sql = "INSERT INTO tablename (value1,value2,value3) VALUES ('$var1','$var2','$var3')";
$result = mysql_query($sql);

Posted

I have a similar question. I created a table, and I want to some information from a form to be added to the db on submitt. What would I have to have in my php file to do this. Can someone spell out for me how to insert to mysql db via a php file. The info that will be inserted is simply a visitors name and email that they insert and submit in my form. Thanks!

Join the conversation

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

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

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