doddsey_65 Posted October 9, 2010 Share Posted October 9, 2010 i am trying to update a column in the database. I can update int columns but what about text? i want to update it so that the new text is added to it while keeping the old one. Here is what i have(which isnt working): mysql_query("UPDATE ".DB_PREFIX."posts SET post_content = '$old_content' + '".$_POST['test']."' WHERE post_id = '$double_post_id'") or die(mysql_error()); i have also tried: SET post_content = post_content + '".$_POST['test']."' but that didnt work either. What should i be doing? Link to comment https://forums.phpfreaks.com/topic/215518-insert-into/ Share on other sites More sharing options...
doddsey_65 Posted October 9, 2010 Author Share Posted October 9, 2010 also tried: SET post_content = post_content AND '".$_POST['test']."' it just keps updating the colum with 0 Link to comment https://forums.phpfreaks.com/topic/215518-insert-into/#findComment-1120682 Share on other sites More sharing options...
PFMaBiSmAd Posted October 9, 2010 Share Posted October 9, 2010 AND is a logical operator. + is a mathematical operator (at least in sql and php.) You would want to use a string function, such as CONCAT() - http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_concat Link to comment https://forums.phpfreaks.com/topic/215518-insert-into/#findComment-1120683 Share on other sites More sharing options...
doddsey_65 Posted October 9, 2010 Author Share Posted October 9, 2010 AND is a logical operator. + is a mathematical operator (at least in sql and php.) You would want to use a string function, such as CONCAT() - http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_concat thanks but i got around it by adding the POST data and $old content into one variable and then using that. Link to comment https://forums.phpfreaks.com/topic/215518-insert-into/#findComment-1120684 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.