You are here:  » ocassional SQL error on home page for featured products

Support Forum



ocassional SQL error on home page for featured products

Submitted by raveon on Fri, 2011-10-14 08:37 in

Some of the time I get the "SQL fetch" error on the home page but not all of the time.

I enabled the database debug in the advanced debug file and this was the more verbose result;

[SELECT * , MIN( price ) AS minPrice, MAX( price ) AS maxPrice, COUNT( id ) AS numMerchants FROM `pt_products` WHERE name IN ('Zodiac USA Rumer (Women's) - Brown Leather','Brooks Hat - White','Comeco E80201CN (Women's) - Multi Canvas','Converse Chuck Taylor All Star Stretch Ox (Infants') - Pink/Multi','Dearfoams DF493 (Women's) - Leopard','Stacy Adams Cullen 24609 (Men's) - Black Leather') GROUP BY name][You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 's) - Brown Leather','Brooks Hat - White','Comeco E80201CN (Women's) - Multi Canv' at line 1]
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/XXXXXX/public_html/includes/database.php on line 27

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/XXXXXX/public_html/includes/database.php on line 32

My guess is bad data. It's amazing to me how many pretty big companies can't seem to manage a simple text output for thousands of thousands of affiliates.

Submitted by support on Fri, 2011-10-14 11:14

Hi raveon,

That sounds like a random featured products modification is not making the product names database safe in the main query (this would explain why the error is occasional, as it depends whether the product names selected contain characters that break the SQL).

Please could you copy any relevant code from index.php and I'll double check the code for you..

Cheers,
David.
--
PriceTapestry.com

Submitted by raveon on Fri, 2011-10-14 17:56

Thanks David but this happens even when not using the random featured products modification. Do you still wnat me to send the code? IE: it happens with the default instal index.php also.

Submitted by support on Fri, 2011-10-14 18:13

Hi raveon,

Please email me your current index.php and also your html/header.php and html/footer.php and I'll check it out straight away...

Thanks,
David.
--
PriceTapestry.com