Stephen68 Posted January 11, 2008 Share Posted January 11, 2008 This is the query that I'm trying to run but not getting what I'm looking for. The ($) values are of course values that I garbed from the submitted form with PHP. I ran an echo on the query code and the query is getting the values put in it, just not the results I wanted ;( $query = "select * from tech where type='$type' heading like \"%$trimmed%\" OR content like \"%$trimmed%\" order by heading LIMIT $offset, $rowsPerPage"; What I'm trying to do is find all the words that match the submitted word in the fields content and heading but only from where type equals a certain value. I hope I'm explaining this right, sure sounds confusing. Any Help would be great! Stephen Link to comment https://forums.phpfreaks.com/topic/85522-mysql-query-help/ Share on other sites More sharing options...
toplay Posted January 11, 2008 Share Posted January 11, 2008 Change this: where type='$type' heading like \"%$trimmed%\" OR content like \"%$trimmed%\" To this: where type = '$type' AND (heading like \"%$trimmed%\" OR content like \"%$trimmed%\") Link to comment https://forums.phpfreaks.com/topic/85522-mysql-query-help/#findComment-436497 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.