Dear All,
I am trying to extract records from a table that have a catid of 2 AND are like the string entered into a search field i.e. a record with a catid of 2 AND a date LIKE 2011-04-29 however when the query is run it returns ALL records LIKE the string and ignores the AND catid = 2 bit. So it returns the records matching that date but doesn't filter them further to display only those records matching the date AND have a catid of 2.
Can anyone explain what changes I need to make so that I can get the result I need.
TIA and Regards
Chris Blair
I am trying to extract records from a table that have a catid of 2 AND are like the string entered into a search field i.e. a record with a catid of 2 AND a date LIKE 2011-04-29 however when the query is run it returns ALL records LIKE the string and ignores the AND catid = 2 bit. So it returns the records matching that date but doesn't filter them further to display only those records matching the date AND have a catid of 2.
<?php
$title = JRequest::getString('title', '', 'post');
if ( $title ) {
}
echo " WHERE (`date` LIKE '%$title%' OR `description` LIKE '%$title%' OR `title` LIKE '%$title%') AND (`catid` = 2)";
?>
Can anyone explain what changes I need to make so that I can get the result I need.
TIA and Regards
Chris Blair