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
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
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.