One solution would be this:
/ have $searchword come from a form or where ever /
$sql = \"select id,keywords from image where keywords like \'%$searchword%\'\";
$sql_result = mysql_query($sql) or die (\"Couldn\'t execute query. (getemail()) \".mysql_error());
while ($row = mysql_fetch_array($sql_result)) {
/* this will create an array of all items delimited by a comma */
$k_array = explode(\",\",$row[\'keywords\'];
$count = count($k_array); /* faster than running count() in for loop */
for ( $i = 0; $i < $count; i++ )
{
if ( $k_array[$i] == $searchword )
do_something();
}
..or i could be way off. but this will explode the keywords into an array, loop through the array to find your specific match 🙂
cheers,
kyle