I currently have two tables one Classifieds (which has the client companyID, adID, adtext, etc.) and then table Keywords (which has ref to adID, keywords, and keywordID).
I am stuck on trying to build the query so the when a client searches they don't pull ads from other clients.
Should I scrap the two tables method and just ad a column in the Classifieds table that contains the one field for the list of keywords??
Code: Select all
It is a basic search. From the submit form I have:
if ($keyword)
{
$k = split(" ", $keyword);
$num_keywords = count ($k);
for ($i=0; $i<$num_keywords; $i++)
{
if ($i)
$k_string .= "or k.keyword = '".$kї$i]."' ";
else
$k_string .= "k_keyword = '".$kї$i]."' ";
}
$and .="and ($k_string) ";
}
$sql = SELECT from classifieds ????s on the MySQL query
$result = mysql_query($sql);
etc... to display the results.
If I add a column to Classifieds for keywords will the $and string look for any part in the keywords field or just ads that contain only one keyword that matches???Thanks - Steve