Jump to content

Issue with ? in comment


mcmuney

Recommended Posts

I have the code below in a script where descriptions can be added to an image, which is referenced in the code as a comment. Everything seems to work fine, EXCEPT when there is a "?" in the comment, in which case, the second update doesn't execute. Any idea why and any solution to this problem?

 

$db->update("UPDATE `sc_member_images` SET ordering=-1 WHERE scm_mem_id='{$social_mem_id}'");
for($i=0;$i<count($_POST['p']);$i++)
{
$q="UPDATE `sc_member_images` SET ordering='".($i+1)."',sci_caption='".addslashes($_POST['p'][$i][comment])."' WHERE sci_id='{$_POST['p'][$i][image]}'";
$db->update_data($q)or die(mysql_error());
}

Link to comment
Share on other sites

Don't use user inputed data directly in database queries anyway, your opening all sorts of cans of worms in relation to security issues.

 

What database engine are you using there? Surely it has mechanisms for escaping data properly?

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.