insaynewrapper Posted June 18, 2006 Share Posted June 18, 2006 [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] Quote Link to comment https://forums.phpfreaks.com/topic/12290-see-if-you-can-debug-this-query/ Share on other sites More sharing options...
poirot Posted June 18, 2006 Share Posted June 18, 2006 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 whateverIf it already prints the wrong query, check what is in $threadSubject Quote Link to comment https://forums.phpfreaks.com/topic/12290-see-if-you-can-debug-this-query/#findComment-46977 Share on other sites More sharing options...
Fyorl Posted June 18, 2006 Share Posted June 18, 2006 I'd also like to point out that in that function, $dieMessage is not declared so you get nothing. Either make it a global/constant or pass it to the function. Quote Link to comment https://forums.phpfreaks.com/topic/12290-see-if-you-can-debug-this-query/#findComment-46979 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.