Jump to content

PHP porting to MySQL UPDATE leads to error [solved]


jeffshen

Recommended Posts

Dear All,

at the moment I have this

[code]echo $stockname;
echo "<br>";
echo $array[0];
echo "<br>";
echo $numstocks;
echo "<br>";
echo $inprice;
echo "<br>";
echo $currtime;
echo "<br>";
echo $uniqueid;
echo "<br>";
$mysqlinsert = "UPDATE `stocks` SET `code` = $stockname , `name` = $array[0] , `owned` = $numstocks , `buy_price` = $inprice , `timestamp` = $currtime WHERE `key` = $uniqueid";
echo $mysqlinsert;
echo"<br>";
mysql_query($mysqlinsert) or die ("Error inserting records");[/code]

where all the random echos are used for debugging... I still cant find the mistake though, when I send that to the browser, the result I get is

0003
HK & CHINA GAS
123
142
1155151474
72
UPDATE `stocks` SET `code` = 0003 , `name` = HK & CHINA GAS , `owned` = 123 , `buy_price` = 142 , `timestamp` = 1155151474 WHERE `key` = 72
Error inserting records

where the last line indicates that the UPDATE function has failed, but I cant see whats wrong with my update function.

can someone please help?

thanks a lot in advance

Jeff
Link to comment
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.