dt192 Posted February 28, 2009 Share Posted February 28, 2009 Hi ive got a MySQL table with values imported from XML, some of the data imported is blank, i am trying to perform a search on the data now that it is in the database and i want to be able to match cells with matching data and also have the option to match cells with no data: "SELECT * FROM mytable WHERE something LIKE '%' AND (somethingelse BETWEEN 0 AND 1000) AND (thisthing='what i searched for' OR thisthing='') ORDER BY the_date DESC" i have also tried (thisthing='blabla' OR thisthing IS NULL) (thisthing='blabla' || thisthing='') i tried removing the brackets lol desperate measures, anywho please end my misery Link to comment https://forums.phpfreaks.com/topic/147357-solved-php-mysql-problem/ Share on other sites More sharing options...
dt192 Posted March 1, 2009 Author Share Posted March 1, 2009 Hi can some one please answer my question, I really want to get this script finished tonight and this problem is stopping me from finishing it in several ways lol oh and something else i found out, once i pull the value from the database and use php to compare it, it does match to '' so in summary SELECT * FROM mytable WHERE thisthing='' would result in 0 rows but if i pull thisthing and did if($rows['thisthing'] == ''){echo 'what the hell is going on';} it would Link to comment https://forums.phpfreaks.com/topic/147357-solved-php-mysql-problem/#findComment-773587 Share on other sites More sharing options...
dt192 Posted March 1, 2009 Author Share Posted March 1, 2009 well since nobody was helping me yet again lol i worked it out myself WHERE thisthing='' did worked WHERE thisthing!='' didnt work (no idea why this didnt work) WHERE thisthing<>'' did worked Link to comment https://forums.phpfreaks.com/topic/147357-solved-php-mysql-problem/#findComment-773599 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.