Jump to content

[SOLVED] Insert not working.


daveoffy

Recommended Posts

I have the following code and I am just missing something stupid. I looked at it many times and than thought I would come here to get an answer.

 

$insert = "INSERT INTO Sell(newstatus, buyer) VALUES('$newstatus', '$buyerusername') WHERE sell_id = '".$sellid."'";
$insertresult = mysql_query($insert);

Link to comment
https://forums.phpfreaks.com/topic/165479-solved-insert-not-working/
Share on other sites

Step one whenever you have a problem, is to use mysql_error() to see what the error is:

$insert = "INSERT INTO Sell(newstatus, buyer) VALUES('$newstatus', '$buyerusername') WHERE sell_id = '".$sellid."'";
$insertresult = mysql_query($insert) or die(mysql_error());

 

you will find that there is no WHERE clause for an INSERT statement. what are you trying to accomplish? Are you looking to UPDATE a record?

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.