Jump to content

Mysql Insert Switching Names And Place


katai

Recommended Posts

Couldn't just post it?

function addPost($pName, $pAuth, $pContent,$pCat = 1) {
$query = mysql_query("INSERT INTO posts VALUES(null,'$pName','$pAuth','$pContent','$pCat')") or die(mysql_error());
}

Specify the names for the fields...

INSERT INTO table (field1, field2, field3) VALUES ("value 1", "value 2", "value 3")

INSERT INTO table SET field1="value 1", field2="value 2", field3="value 3"

because I bet your problem is that you haven't noticed how the order of the fields in the table don't agree with the order of the fields in your SQL.

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.