manalnor Posted March 29, 2011 Share Posted March 29, 2011 Hello friends, Can you help me as always. let say we have database table (id,user,name,code) and i'm gonna say MYSQL $qry="select * from table order by id desc"; Now how to say select from table where (user) is not empty and (code) is not 'something' i did tried this $qry="select * from table where user IS NOT NULL AND code IS NOT LIKE 'something' order by id desc"; but didn't work so how to say it and where i could learn such mysql commands cause i know it only in php like x == y and x != y ..ect thanks Link to comment https://forums.phpfreaks.com/topic/232077-how-to-say-it/ Share on other sites More sharing options...
Maq Posted March 29, 2011 Share Posted March 29, 2011 If you want to exclude an exact value then use: AND code != 'something' EDIT: Also, I'm not sure what your default value is (assume it's NULL) but you may want to check for an empty string as well. AND user != '' Link to comment https://forums.phpfreaks.com/topic/232077-how-to-say-it/#findComment-1193762 Share on other sites More sharing options...
manalnor Posted March 29, 2011 Author Share Posted March 29, 2011 thank you so much i did understood how it works both user != '' and code != 'something' works perfect shokran شكراً = thanks Link to comment https://forums.phpfreaks.com/topic/232077-how-to-say-it/#findComment-1193766 Share on other sites More sharing options...
Maq Posted March 29, 2011 Share Posted March 29, 2011 shokran شكراً = thanks Heh, I actually knew that, my buddy is Lebanese You're welcome. Link to comment https://forums.phpfreaks.com/topic/232077-how-to-say-it/#findComment-1193771 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.