atholon Posted October 4, 2007 Share Posted October 4, 2007 Hey guys, dunno if I am posting this in the right spot but I have a question... do you see anything wrong with the following query? mysql_query("UPDATE tutorials SET title='$title', description='$description', date='$date', category1='$category1', approved='yes' WHERE stepnumber='$stepnumber' AND tutorialnumber='$tutorialid'") or die ("<br /><br />Mysql Error: ".mysql_error()); mysql_query("UPDATE tutorials SET title='$title', description='$description', approved='$approved', date='$date', category='$category1', user='$currentuser' WHERE stepnumber='$stepnumber' AND `tutorialnumber`='$tutorialid'") or die ("<br /><br />Mysql Error: ".mysql_error()); It is giving me a WHERE error Mysql Error: Unknown field “stepnumber” in where clause Quote Link to comment https://forums.phpfreaks.com/topic/71847-weird-query/ Share on other sites More sharing options...
wildteen88 Posted October 4, 2007 Share Posted October 4, 2007 Basically means MySQL cannot find a field called “stepnumber” within the tutorials table. Make sure you have spelt the field name correctly (check with the tutorials table schema) Quote Link to comment https://forums.phpfreaks.com/topic/71847-weird-query/#findComment-361885 Share on other sites More sharing options...
cooldude832 Posted October 4, 2007 Share Posted October 4, 2007 Also Watch your escaping of variables. This is just my preference, but I like doing queries like </php $q = "UPDATE `tutorials` SET title='".$title."', description='".$description."', date='".$date."', category1='".$category1."', approved='yes' WHERE stepnumber='".$stepnumber."' AND tutorialnumber='".$tutorialid."'"; $r = mysql_query($q) or die(mysql_error()); ?> That way I can quote out all my variables so no worry about escaping, and also I can tell issues very easily. Just a thought. Quote Link to comment https://forums.phpfreaks.com/topic/71847-weird-query/#findComment-361904 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.