Jump to content

MySql Error on Updating when 'this' quotation mark in variable


casbboy

Recommended Posts

I have a php update like this:

[code=php:0]
$upsql = mysql_query("UPDATE comments SET comment2='$oldcomment', comment='$newcomment', edited='y', verified='$verified' WHERE user_id='$userid' AND edited='n' AND comment_id='$commentid'", $connection)
or die(mysql_error());
[/code]

The problem is that $oldcomment features a ton of text that has both "this" type of quotation marks and 'this' type of quotation marks. I get a mysql error because of these quotation marks when trying to update the database.

I have done a string replace to pull them out just for testing sake and the update works fine... so it is the existance of the quotation marks that are causing issues.

i NEED these quotation marks to remain, but how can I do the update query and avoid the error?

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