You are here:  » mysql_fetch_array() and mysql_num_rows() errors

Support Forum



mysql_fetch_array() and mysql_num_rows() errors

Submitted by wayman on Wed, 2011-12-14 20:11 in

I recently uploaded some updated feeds (first time in a while) and it crashed the site. The debugmode error message is:

[SELECT COUNT(DISTINCT(name)) as resultcount FROM `db_products` WHERE merchant = 'MerchantName' ][Table './dbname/db_products' is marked as crashed and should be repaired]
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /nfs/c01/h11/mnt/32469/domains/domain.com/html/includes/database.php on line 27
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /domain/html/includes/database.php on line 32
[SELECT * , MIN( price ) AS minPrice, MAX( price ) AS maxPrice, COUNT( id ) AS numMerchants FROM `db_products` WHERE merchant = 'MerchantName' GROUP BY name LIMIT 0,10][Table './dbname/db_products' is marked as crashed and should be repaired]
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /nfs/c01/h11/mnt/32469/domains/domain.com/html/includes/database.php on line 27
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /nfs/c01/h11/mnt/32469/domains/domain.com/html/includes/database.php on line 32
Warning: Cannot modify header information - headers already sent by (output started at /nfs/c01/h11/mnt/32469/domains/domain.com/html/includes/database.php:22) in /nfs/c01/h11/mnt/32469/domains/domain.com/html/html/header.php on line 6

From the "db_products' is marked as crashed and should be repaired" I figured it was a crashed table and created a repair.php using the step you mentioned in http://www.pricetapestry.com/node/4338 It returns "Done" but the problem persists.

Any suggestions?
-Wayman

Submitted by support on Wed, 2011-12-14 23:10

Hi Wayman,

That's strange as a REPAIR TABLE would normally resolve such errors. The next thing I would try would be to TRUNCATE the table, and then re-import all. In exactly the same way as repair.php, create a file truncate.php with the following code;

<?php
  set_time_limit
(0);
  require(
"includes/common.php");
  
$sql "TRUNCATE `".$config_databaseTablePrefix."products`";
  
database_queryModify($sql,$result);
  print 
"Done.";
?>

That should completely reset the table; and then follow by a full import.

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by wayman on Thu, 2012-01-05 19:06

Thanks David, Sorry for the late reply. I dropped off the grid for the holidays.

The truncate file cleared out the error. Then I got duplicate/header errors. After examination the duplication is happening in the feed. Working on sanitizing that and hopefully Price.aero will be back up to full speed.