ahs10 Posted February 1, 2008 Share Posted February 1, 2008 here it is, i have records in my database that meet this criteria. what's wrong? $query = "SELECT record_id, record_status, DATE_FORMAT(record_date, '%c/%e/%Y') AS record_date FROM records WHERE (record_location LIKE 'TX') AND (record_status != 'REJECTED' AND record_status != 'CANCELLED')"; ...if i finish this up with.... $result = mysql_query($query); $numRows = mysql_num_rows($result); ....then $numRows equals zero and that's not the case Link to comment https://forums.phpfreaks.com/topic/88908-solved-whats-wrong-with-my-query/ Share on other sites More sharing options...
revraz Posted February 1, 2008 Share Posted February 1, 2008 LIKE 'TX' is looking for exactly TX. If you want it to look for anything with TX in it, use %TX% Link to comment https://forums.phpfreaks.com/topic/88908-solved-whats-wrong-with-my-query/#findComment-455397 Share on other sites More sharing options...
ahs10 Posted February 1, 2008 Author Share Posted February 1, 2008 no shit? really, you have to use wildcards? wow, thanks. so why is that? seems to me that LIKE isn't necessary. couldn't you just say = '%TX%' instead? what's the point of LIKE? thanks again for the answer though. Link to comment https://forums.phpfreaks.com/topic/88908-solved-whats-wrong-with-my-query/#findComment-455402 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.