Jump to content

INSERT INTO


doddsey_65

Recommended Posts

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

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

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.