Jump to content

Insert into - a few questions


xwishmasterx

Recommended Posts

I am trying to create a simple form for inserting to a database table.

 

It seems the data from the form are passed through the "insert" script, but nothing is added to the table.

 

My question is: what is required to insert new data to a table? must all fields have a value for the new data to be added?

Link to comment
https://forums.phpfreaks.com/topic/233534-insert-into-a-few-questions/
Share on other sites

If you want to insert a row with only some fields set, use a syntax like this:

INSERT INTO table (field1, field2, field3) VALUES ('value1', 'value2', 'value3')

 

Check for errors in your queries by specifying something like this:

$result = mysql_query($sql) or die("MySQL Error: ".mysql_error());

Archived

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

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