You are here:  » Getting Strange Errors


Getting Strange Errors

Submitted by justindedge on Tue, 2013-12-03 00:23 in

On the admin and home page

Warning: mysql_query() expects parameter 2 to be resource, boolean given in /home/content/13/12051513/html/includes/database.php on line 18

Warning: mysql_fetch_array() expects parameter 1 to be resource, null given in /home/content/13/12051513/html/includes/database.php on line 27

Warning: mysql_num_rows() expects parameter 1 to be resource, null given in /home/content/13/12051513/html/includes/database.php on line 32

HELP!

Submitted by support on Tue, 2013-12-03 08:32

Hello Justin,

The same error on both home page and /admin/ home page sounds like you might be using a mod to show total number of products but something has happened to the `feeds` table. To see the actual MySQL error you can enable database debug mode by changing line 6 of config.advanced.php as follows;

  $config_databaseDebugMode = TRUE;

Then view your /admin/ home page again, and if the error indicates that the feeds table is marked as crashed you can repair it with the following code. Copy and paste the code into a new script called repair.php and run from the top level folder of your Price Tapestry installation:

<?php
  
require("includes/common.php");
  
$sql "REPAIR TABLE `".$config_databaseTablePrefix."feeds`";
  
database_queryModify($sql,$result);
  print 
"Done.";
?>

If not, let me know what is displayed with debug mode enabled and I'll check it out further for you...

Cheers,
David.
--
PriceTapestry.com

Submitted by justindedge on Wed, 2013-12-04 00:29

David,

I dropped a new feed in and tried to register it. I got this error

Warning: mysql_query() expects parameter 2 to be resource, boolean given in /home/content/13/12051513/html/includes/database.php on line 18

Warning: mysql_fetch_array() expects parameter 1 to be resource, null given in /home/content/13/12051513/html/includes/database.php on line 27

Warning: mysql_num_rows() expects parameter 1 to be resource, null given in /home/content/13/12051513/html/includes/database.php on line 32

Warning: mysql_query() expects parameter 2 to be resource, boolean given in /home/content/13/12051513/html/includes/database.php on line 51

Warning: mysql_insert_id() [function.mysql-insert-id]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /home/content/13/12051513/html/includes/database.php on line 58

Warning: mysql_insert_id() [function.mysql-insert-id]: A link to the server could not be established in /home/content/13/12051513/html/includes/database.php on line 58

Warning: mysql_affected_rows() [function.mysql-affected-rows]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /home/content/13/12051513/html/includes/database.php on line 60

Warning: mysql_affected_rows() [function.mysql-affected-rows]: A link to the server could not be established in /home/content/13/12051513/html/includes/database.php on line 60

Warning: Cannot modify header information - headers already sent by (output started at /home/content/13/12051513/html/includes/database.php:18) in /home/content/13/12051513/html/admin/feeds_register_step2.php on line 79

Should I just create a new database?

Submitted by support on Wed, 2013-12-04 06:48

Hello Justin,

That actually indicates that the MySQL server configuration originally set-up in config.php is no longer valid.

To test the database connection you can always browse to http://www.yoursite.com/setup.php which will run the normal tests that you see during set-up. From the output you see double-check the $config_database... settings in config.php until all tests are shown as passed.

If you're still not sure let me know the installation URL (I'll remove before publishing your reply) and I'll check it out further with you.

One thing to bear in mind, once back up and running don't forget to turn debug mode back off by changing line 6 in config.advanced.php back to:

  $config_databaseDebugMode = FALSE;

...this is because during import, "intentional" errors can occur (DUPLICATE KEY) as part of the duplicate prevention mechanism.

Cheers,
David.
--
PriceTapestry.com

Submitted by justindedge on Thu, 2013-12-05 00:10

Godaddy changed the domain address. Figured it out. Thanks David.