You are here:  » SQL Random Type and Limit Not Working Correctly


SQL Random Type and Limit Not Working Correctly

Submitted by twdesigns on Tue, 2013-03-26 15:15 in

For some reason I can not add more than one word to my search string. I have Tried HP DESKJET, HP+DESKJET and it will pull in 0 results. I have tried many other 2 word phrases with 0 response. What am I doing wrong?

$sql = "SELECT name,1 AS sequence FROM `".$pto_config_databaseTablePrefix."products` WHERE name LIKE '%HP+DESKJET%' ORDER BY RAND() LIMIT 10";

Submitted by support on Tue, 2013-03-26 15:23

Hi Tommy,

Have a go with:

$sql = "SELECT name,1 AS sequence FROM `".$pto_config_databaseTablePrefix."products` WHERE name LIKE '%HP%DESKJET%' ORDER BY RAND() LIMIT 10";

If still no joy, if you could post a couple of links to /product/ pages that you would expect to be matched (i'll remove before publishing your reply), and if you could paste your full modified pto_featured.php (again I'll delete before posting) I'll check it out for you...

Cheers,
David.
--
PriceTapestry.com

Submitted by twdesigns on Tue, 2013-03-26 18:32

David,

That did the trick!

Thank you,
Tommy