physaux Posted November 5, 2009 Share Posted November 5, 2009 My code is not working: SELECT * FROM table_name WHERE column= `` I am trying to find all the entries in my table "table_name", that have not yet any value defined for "column" -I know this is the query, because I use $query = text, then I echo'd, printed, and echo'd with htmlspecialchars(), and all were the same. -My database does have a table called "table_name", i 5X checked that in php my admin -one of the columns in this table is 100% sure "column" -this table is populated with well over 200 entries, and they are all empty in that column The table-column settings: -NULL: No, DEFAULT: None -when I added the entries in the first place, I did so like this: ..., '', ... -so in VALUES() the corresponding spot was just empty, with two collons ' and ', no space inbetween Can anyone advise me how I can make this work? Thanks! EDIT: and yes, the query does have a ";" at the end, I forgot to put that here. Quote Link to comment https://forums.phpfreaks.com/topic/180459-solved-select-from-table_name-where-column-not-working/ Share on other sites More sharing options...
.josh Posted November 5, 2009 Share Posted November 5, 2009 use single quotes instead of backticks. Quote Link to comment https://forums.phpfreaks.com/topic/180459-solved-select-from-table_name-where-column-not-working/#findComment-951999 Share on other sites More sharing options...
physaux Posted November 5, 2009 Author Share Posted November 5, 2009 thanks, I'll remember this lol, caused me over an hour of pain! Quote Link to comment https://forums.phpfreaks.com/topic/180459-solved-select-from-table_name-where-column-not-working/#findComment-952003 Share on other sites More sharing options...
.josh Posted November 5, 2009 Share Posted November 5, 2009 backticks are only used around column and table names, and even then they are not necessary unless you have a column or table name that is a reserved word (and that's only for mysql, and you shouldn't be naming your column/table names reserved words anyways, bad practice). IOW in practice you should never have to use backticks. Though some editors like to sneak them in, change quotes to backticks and stuff. Quote Link to comment https://forums.phpfreaks.com/topic/180459-solved-select-from-table_name-where-column-not-working/#findComment-952019 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.