Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/71847-weird-query/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/71847-weird-query/#findComment-361904
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.