I'm having difficulty in trying to figure out a way to loop through a query and extract the info from a single column into an array. Here is what I am looking for. In the table, I have a column called keywords that has a string of information that are separated with a comma. I am looking for a way to extract each keyword from the one cell and make a conditional on it. Otherwise its like this:
Column keywords has in a single cell - TV,television,HDTV,projection I want to loop through each row cell in the column keywords and write out each keyword to its own placement to be compared to what the user submits. I was thinking of something like this but this is as far as I've gotten. $search_string = $_POST["search"]; $search_string = strip_tags($search_string); $search_string = strtolower($search_string); $search_string = str_replace("\n", "", $search_string); $search_string = strip_chars($search_string); //calls a formula which strips specific chars $search_string = str_replace(",", "", $search_string); $search_string = explode(" ", $search_string); $search_string = strip_words($search_string); //calls a formula which strips specific words $keywords = mssql_query("select keywords from category"); for ($i=0; i < mssql_num_rows($keywords); $i++) { $keywords = mssql_result($keywords,0,"keywords"); //this will assign the full string to the variable keywords if ($keywords == $search_string){ echo ("keyword $keywords found"); } } I can't figure out how to separate each keyword by the comma and then write that specific keyword to an array to be used. Any and all help would be appreciated. thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php