jeffshen Posted August 9, 2006 Share Posted August 9, 2006 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 0003HK & CHINA GAS123142115515147472UPDATE `stocks` SET `code` = 0003 , `name` = HK & CHINA GAS , `owned` = 123 , `buy_price` = 142 , `timestamp` = 1155151474 WHERE `key` = 72Error inserting recordswhere 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 advanceJeff Link to comment https://forums.phpfreaks.com/topic/17054-php-porting-to-mysql-update-leads-to-error-solved/ Share on other sites More sharing options...
kalivos Posted August 9, 2006 Share Posted August 9, 2006 Try this$mysqlinsert = "UPDATE `stocks` SET `code` = '$stockname' , `name` = '".$array[0]."' , `owned` = '$numstocks' , `buy_price` = '$inprice' , `timestamp` = '$currtime' WHERE `key` = '$uniqueid'"; Link to comment https://forums.phpfreaks.com/topic/17054-php-porting-to-mysql-update-leads-to-error-solved/#findComment-71985 Share on other sites More sharing options...
jeffshen Posted August 9, 2006 Author Share Posted August 9, 2006 Thanks a lot kalivos it worked =)Jeff Link to comment https://forums.phpfreaks.com/topic/17054-php-porting-to-mysql-update-leads-to-error-solved/#findComment-71996 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.