bobleny Posted April 14, 2007 Share Posted April 14, 2007 Something wrong with my syntax!? $sql = "UPDATE `options` SET `set` = '1' WHERE `name` = `signup`"; It keeps giving me this error: Unknown column 'signup' in 'where clause' I don't know what is wrong. Link to comment https://forums.phpfreaks.com/topic/47043-solved-something-wrong-with-my-syntax/ Share on other sites More sharing options...
AndyB Posted April 14, 2007 Share Posted April 14, 2007 $sql = "UPDATE `options` SET `set` = '1' WHERE `name` = 'signup'"; The above will work. By the way, using reserved words as field names and being forced to use backticks all the time is not a very good practice. Link to comment https://forums.phpfreaks.com/topic/47043-solved-something-wrong-with-my-syntax/#findComment-229408 Share on other sites More sharing options...
bobleny Posted April 14, 2007 Author Share Posted April 14, 2007 The above will work. By the way, using reserved words as field names and being forced to use backticks all the time is not a very good practice. Hmm... Could you explain? I'm not sure what you mean by "reserved words". I thought you where supposed to use "backticks"? Link to comment https://forums.phpfreaks.com/topic/47043-solved-something-wrong-with-my-syntax/#findComment-229416 Share on other sites More sharing options...
bubblegum.anarchy Posted April 14, 2007 Share Posted April 14, 2007 MySQL is interpretting the backtick quoted signup string as a table name rather than a string... wrap insert strings with single quotes. Link to comment https://forums.phpfreaks.com/topic/47043-solved-something-wrong-with-my-syntax/#findComment-229419 Share on other sites More sharing options...
AndyB Posted April 14, 2007 Share Posted April 14, 2007 Using MySQL reserved words for table names or field names is a very bad practice. Using backticks is a sloppy work-around for scripts where reserved words have been used for table names or field names. Avoid the problem and the backticks by checking the list of MySQL reserved words ... in the manual. http://dev.mysql.com/doc/refman/5.0/en/reserved-words.html Don't confuse those awful `backticks` with perfectly good 'quotes'. Link to comment https://forums.phpfreaks.com/topic/47043-solved-something-wrong-with-my-syntax/#findComment-229421 Share on other sites More sharing options...
bobleny Posted April 15, 2007 Author Share Posted April 15, 2007 Ok, thanks. I'll keep that in mind for next time, but I'll still use the "backticks" Link to comment https://forums.phpfreaks.com/topic/47043-solved-something-wrong-with-my-syntax/#findComment-229554 Share on other sites More sharing options...
AndyB Posted April 15, 2007 Share Posted April 15, 2007 ... but I'll still use the "backticks" Why? Link to comment https://forums.phpfreaks.com/topic/47043-solved-something-wrong-with-my-syntax/#findComment-229642 Share on other sites More sharing options...
bobleny Posted April 15, 2007 Author Share Posted April 15, 2007 ... but I'll still use the "backticks" Why? Do you really think they are that bad? I thought they added a big of organization to MySQL strings. If you really think they are a bad thing then I'll consider not using them? Link to comment https://forums.phpfreaks.com/topic/47043-solved-something-wrong-with-my-syntax/#findComment-229892 Share on other sites More sharing options...
fenway Posted April 20, 2007 Share Posted April 20, 2007 They are bad... don't use them. Link to comment https://forums.phpfreaks.com/topic/47043-solved-something-wrong-with-my-syntax/#findComment-233935 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.