Hi Guys
I updated to the latest version over the weekend - but now I keep getting the following message...
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /path/to/includes/database.php on line 21
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /path/to/includes/database.php on line 26
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /path/to/includes/database.php on line 21
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /path/to/includes/database.php on line 26
Does anyone know why? and what i can do to fix it?
Chris
Thanks for the quick reply David, but I has realised that there were more changes to the database so had completley deleted it before reinstalling.
Perhaps I should be clearer - I have PT running side by side with Textpattern - which apart from the index.php I haven't changed. Textpattern seems ot communicate hapily with the Database.
If i go to the merchant list - the page renders fine - its only when i come to pull up a product page or a search page that I get the error message. - I had thought it was database connection problem but it seems specifically linked to product pages (sso brand and category don't work either).
Chris
Hi Chris,
One way to help debug is to make the following changes to includes/database.php.
Immediately after the following code (after line 17 and 43):
$result = mysql_query($sql,$link);
Add the code:
if (!$result)
{
print "SQL QUERY [".$sql."] FAILED ";
print "[".mysql_error()."]";
}
(you need to add this code twice, once in each function)
Then view the page again, and it should display the SQL that is causing the error. If you could post the message that will help us figure out what is wrong.
Because you say it happens on both the search and product pages I don't think it's down to the MySQL version; although it is worth checking that you have at least 3.23.23 (see link below) as the new version requires that as a minimum...
http://www.pricetapestry.com/node/82
Cheers,
David.
PHP info...
http://now3k.co.uk/phpinfo.php
The site itself...
http://now3k.co.uk
Thanks for that, Chris,
Would you mind making the code change as described above (we cross posted!), so that I can see the SQL that is causing the error.
Thanks,
David.
David, thanks but I managed to fix the problem.
It appears that the products database table had managed to corrupt itself (so not a PT problem after all)
I fixed it by running
REPAIR TABLE tableprefix_products
Using PHPmyAdmin
David,
I am moving my accounts from a host with mySQL 4 to one with mySQL 5. I started with one so I can test before moving the others and get the same errors. Is there a way to convert the database before moving it?
Bill Whelan
David,
After deleting then recreating the entire database then registering a feed, I get the following:
login as: root
root@sitename's password:
root@sitename [~]# /usr/bin/php /home/sitename/public_html/scripts/import.php @ALL
X-Powered-By: PHP/4.4.6
Content-type: text/html
importing 10273762-FansEdge_com.txt...[3400/0]<br />
<b>Warning</b>: mysql_fetch_array(): supplied argument is not a valid MySQL res ult resource in <b>/home/sitename/public_html/includes/database.php</b> on line <b>22</b><br />
<br />
<b>Warning</b>: mysql_num_rows(): supplied argument is not a valid MySQL result resource in <b>/home/sitename/public_html/includes/database.php</b> on line <b> 27</b><br />
importing 10273762-FansEdge_com.txt...[done]
backfilling reviews... <br />
<b>Warning</b>: mysql_fetch_array(): supplied argument is not a valid MySQL res ult resource in <b>/home/sitename/public_html/includes/database.php</b> on line <b>22</b><br />
<br />
<b>Warning</b>: mysql_num_rows(): supplied argument is not a valid MySQL result resource in <b>/home/sitename/public_html/includes/database.php</b> on line <b> 27</b><br />
backfilling reviews...[done]
root@server [~]#
root@server [~]#
Any ideas?
Bill Whelan
Hi Bill,
Does setup.php show all tests passed on the new site?
To find out what's going on, I would add the debug code shown in the 3rd reply in this thread - make the changes to includes/database.php, then run your import script from the command line as you have shown above.
The debug code will print out the SQL that is failing; and the error message. If you could post back the output that you get this will help work out what's happening...
Cheers,
David.
I did not setup from scratch but restored a home directory and database backup when moving from a cPanel to another cPanel account.
I think it's fixed though. I originally restored when logged into the WHM as root/reseller but when restoring the database while logged into the panel as the user, it was working with no apparent problems.
It must have been some sort of permissions issue with the database files.
Bill Whelan
Hi David
Woke up this morning to find products table corrupted.
Recreated the product table only as others appear ok and run the setup check with success.
I added the error report as suggested above and get the following message:
[Can't create/write to file '/tmp/#sql_1013_0.MYI' (Errcode: 28)]
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /homepages/1/d241171195/htdocs/product-reviews/includes/database.php on line 27
Any ideas what has gone wrong or what I need to do to fix?
Many thanks
Regards
Richard
Hi Richard,
Very occasionally, a MySQL table can become corrupted, often because of a pending hard disk fault; so if it happens again it would be worth contacting your host!
There are 2 options; firstly you can try and REPAIR the table - this normally works, but how long it takes depends on the size of the table of course. You can do this through phpMyAdmin (navigate to your database, then the products table and then the Operations tab from where you will find the repair function.
In case you don't have phpMyAdmin or your database tool does not have a repair function drop me an email and I will send you a PHP script that issues the same command.
If that does work, the next option is to DROP the products table and then run setup.php again by browsing to:
setup.php?installDB=1
This will recreate any non-existent tables, but won't overwrite your existing ones, e.g. feed registration.
Cheers,
David.
Hi David
Thanks for info. I have just noticed that the post table in the wordpress database is also corrupted. I have tried to repair using phpmyadmin witout success.
I dropped the product table in the PT database and recreated.
Just did a repair on all tables in PT database and the product table is again corrupt!
1&1 are indicating that it was temporary memory that was full & created errors. This has been increased to 2Gb, so time will tell when they restore databases
Hi,
I've put this line in my mysql.ini
myisam-recover=backup,force
It should fix any corruption on the fly and I believe it is triggered when MySQL is stopped and started. If you can schedule a restart every other night or so, then it should keep your tables in tip-top condition. MyISAM tables are prone to corruption by all accounts.
Cheers.
Keeop
Just a simple update on this issue. With me it did not show an error message... so logically it had to be something else, on my local machine it was no problem just adding localhost/directory (in the config.php file), however om my webhost this config did not work. the setting that worked was adding a / to the end. (so: $config_baseHREF = "http://www.mydomain.com/price/"; )That solved the issue for me. Hope that will help some more people.
cheers.
Hi Chris,
This is problably because you are still using your old database. The new version has more tables and new fields, so i'm afraid it is not possible to upgrade - the database must be re-installed.
You can do this by dropping your current database and then running setup.php again. Apologies for the inconvenience.
Regards,
David.