Warning: mysql_query() [function.mysql-query]: Unable to save result set in [closed]
Here are my errors:
Warning: mysql_query() [function.mysql-query]: Unable to save result set in D:\Users\avinash\liveprojects\WordPressDemo\wp-admin\export.php on line 31
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in D:\Users\avinash\liveprojects\WordPressDemo\wp-admin\export.php on line 54
my query working fine in phpmyadmin.
but its not running with PHP.
I have repaired the tables, optimized the tables,
used mysql_query("SET SQL_BIG_TABLES=1");
But nothing seems to be working.
Any suggestion?
Query :
$sql ="select p.id,p.name,p.slug,p.summary,p.description,IF(p.published='on','Y','N') as published, (SELECT c.name FROM wp_shopp_category c WHERE c.id=(SELECT cat.category FROM wp_shopp_catalog cat WHERE cat.product=p.id AND cat.category IN (SELECT c.id FROM wp_shopp_category c WHERE c.parent='13'))) as BrandName, (SELECT GROUP_CONCAT(cat.category) FROM wp_shopp_catalog cat WHERE cat.product=p.id AND cat.category NOT IN (SELECT c.id FROM wp_shopp_category c WHERE c.parent='13') AND cat.category<>13) as catName, (SELECT GROUP_CONCAT(src SEPARATOR ',') from wp_shopp_asset ast WHERE (ast.src='0' OR ast.src=ast.id) AND ast.parent=p.id AND ast.name LIKE 'thumbnail%' ORDER BY ast.sortorder ASC) as images, price.price, (price.price - price.saleprice) as discount from wp_shopp_product p LEFT JOIN wp_shopp_price price on p.id=price.product WHERE price.optionkey='0'";
If this subquery:
SELECT cat.category FROM wp_shopp_catalog cat WHERE cat.product=p.id AND cat.category IN (SELECT c.id FROM wp_shopp_category c WHERE c.parent='13')
returns multiple results then you will get that error message. Perhaps it should be
c.id IN (SELECT ...)
or:
c.id=(SELECT ... LIMIT 1)
精彩评论