Re: querying comma seperated values in a db field?
Here is my sql statement:
$sql_statement ="
SELECT product.product_id, product.product_name, product.product_imgsm, product.product_xcat, category.category_header_name, category.category_imgsm FROM product JOIN category ON product.product_xcat=category.category_id WHERE product_xcat IN($dbins_fd_ref) ORDER BY RAND($product_name) limit 3
";
All that I need to do is make the WHERE clause search for a string literal that is respresented by the $dbins_fd_ref variable in a comma separated list that resides in the product_xcat column of the product table and return the select statement results when the string literal is found. I do not need for ALL of the comma seperated values to match, I am looking for the existance of the $dbins_fd_ref literal in one or more of the comma separated values of the product_xcat column.
I have tried IN and FIND_IN_SET with no luck.
Thank you for helping me with this.
Subject
Written By
Posted
September 27, 2006 11:39PM
September 27, 2006 11:50PM
September 28, 2006 12:36AM
September 28, 2006 09:21AM
Re: querying comma seperated values in a db field?
September 28, 2006 09:49AM
September 28, 2006 10:07AM
September 28, 2006 10:25AM
September 28, 2006 01:31PM
September 28, 2006 02:21PM
September 28, 2006 02:38PM
September 28, 2006 03:29PM
September 28, 2006 03:38PM
September 28, 2006 03:43PM
September 28, 2006 06:00PM
September 28, 2006 06:11PM
September 28, 2006 06:50PM
September 28, 2006 07:08PM
September 28, 2006 07:25PM
September 28, 2006 10:13PM
September 29, 2006 05:25AM