Jump to content

See if you can debug this query


insaynewrapper

Recommended Posts

[code]doQuery(sprintf("UPDATE `forum_threads` SET `subject`='%s' AND `text`='%s' WHERE `id`='%s' LIMIT 1", $threadSubject, $threadText, $threadid));[/code]

It looks fine to me. When I insert something with that it inserts fine, and everything is fine. But when I go to edit it, it changes the subject to '0' no matter what you try to set it as. I've determined that it is something in this line that does it..

The code to doQuery is
[code]function doQuery($query)
{
    $query = mysql_query($query .';') or die($dieMessage . "\n<br />". mysql_errno() .': '. mysql_error() .'</p>');
    return $query;
}[/code]
Link to comment
Share on other sites

When in doubt, echo out your query.

[code]function doQuery($query)
{
    $query = mysql_query($query .';') or die($dieMessage . "\n<br />". mysql_errno() .': '. mysql_error() .'</p>');
   echo 'Query:' . $query;
    return $query;
}[/code]

If it is right, maybe 'subject' is using the wrong data type (MySQL) - like INT instead of VARCHAR or whatever

If it already prints the wrong query, check what is in $threadSubject
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.