iainlang Posted March 11, 2008 Share Posted March 11, 2008 When trying to update a table, the following works only occasionally; it doesn't work reliably. Can anyone show me where I'm going wrong, please? // $comments_new is the data incoming from the form ; $Query="SELECT comments FROM clients WHERE id='$cli_update_id' "; $Result=mysql_db_query ($DBName, $Query, $Link); while ($Row=mysql_fetch_array ($Result)) { $comments_old=$Row[comments]; } $comments=$comments_old." <br>".$comments_new; $Query="UPDATE clients SET comments='$comments' WHERE id='$cli_update_id' "; $Result=mysql_db_query ($DBName, $Query, $Link); TIA. Link to comment https://forums.phpfreaks.com/topic/95575-updating-table-works-unreliably/ Share on other sites More sharing options...
haku Posted March 11, 2008 Share Posted March 11, 2008 Maybe its because mysql_db_query is deprecated. php.net has this to say: This function is deprecated, do not use this function. Use mysql_select_db() and mysql_query() instead. link Link to comment https://forums.phpfreaks.com/topic/95575-updating-table-works-unreliably/#findComment-489270 Share on other sites More sharing options...
iainlang Posted March 11, 2008 Author Share Posted March 11, 2008 Nope, it can't be that becos mysql_db_query works everywhere else. I see that my query didn't make it through unscathed - I should have written - $comments=$comments_old." br_within_angle-brackets ".$comments_new; Link to comment https://forums.phpfreaks.com/topic/95575-updating-table-works-unreliably/#findComment-489295 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.