ixalmida;10923907 wrote:Oops - I just noticed that I left out the wildcards in the query string.
This:
$query .= "'$keyword' OR LIKE ";
Should be:
$query .= "'%$keyword%' OR LIKE ";
Or, for better visability:
$query .= "'%".$keyword."%' OR LIKE ";
Hmmm I must be doing something wrong. The value is always coming up as "Array".
To make sure I know what's going on:
// Initial query string...
$query = "select help_page_id, title from support.help_pages where content like ";
This part is my query that I currently use to retrieve the records.
// Create an array of keywords...
$keywrds = explode(" ", $_POST['keywords']);
The array is created but is $keywrds a new variable I am creating? HOw about the $_POST['keywords'] is keywords the value of the field in my form?
// Add keywords to your query...
foreach($keywds as $keyword)
$query .= "'%$keyword%' OR LIKE ";
Not sure but the query gets cut off in the end when I echo it to see
// Remove the last "OR LIKE "...
$query = substr($query, 0, -8);
Can you explain this one?
So sorry about all the questions but I'm trying to learn. Thanks so much for your help