You are here:  » Database error

Support Forum



Database error

Submitted by henk on Mon, 2013-03-25 09:50 in

Hi David,

i have got this error only on products page is this because i use the old database and a new installation?:

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/{code saved}/public_html/hwpt/includes/database.php on line 27

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in /home/{code saved}/public_html/hwpt/includes/database.php on line 32

Warning: Cannot modify header information - headers already sent by (output started at /home/{code saved}/public_html/hwpt/includes/database.php:27) in /home/{code saved}/public_html/hwpt/html/header.php on line 6

{link saved}

Thx
Henk

Submitted by support on Mon, 2013-03-25 10:02

Hello Henk,

Please could you temporarily enable database debug mode by changing line 6 of config.advanced.php as follows;

  $config_databaseDebugMode = TRUE;

...then view the page again and let me know the extended MySQL error message that is displayed if you're not sure from the output where the problem lies, and I'll check it out!

Thanks,
David.
--
PriceTapestry.com

Submitted by henk on Mon, 2013-03-25 10:13

Hi David.

Here are the results.

[SELECT DISTINCT(name),MATCH name AGAINST ('Apple iPhone 4 8GB White') AS relevance FROM `pt_products` IGNORE INDEX (name_2) WHERE name <> 'Apple iPhone 4 8GB White' AND category = 'Los Toestel' AND brand = 'Apple' ORDER BY relevance DESC LIMIT 3][Key 'name_2' doesn't exist in table 'pt_products']

Thx
Henk

Submitted by support on Mon, 2013-03-25 10:23

Hello Henk,

That sounds like keys may not have been re-enabled following an import with disable / enable keys mod. Create the following file as enablekeys.php, upload and browse to the file once, and that should restore everything to normal...

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

Cheers,
David.
--
PriceTapestry.com

Submitted by henk on Mon, 2013-03-25 10:31

Hi David,

Must i reimport the files?

I have this still these error

[SELECT DISTINCT(name),MATCH name AGAINST ('GREAT JONES POM BEAN GREAT JONES POM BEAN U1519') AS relevance FROM `pt_products` IGNORE INDEX (name_2) WHERE name <> 'GREAT JONES POM BEAN GREAT JONES POM BEAN (U1519)' AND category = 'Schoenen' AND brand = 'Ugg' ORDER BY relevance DESC LIMIT 3][Key 'name_2' doesn't exist in table 'pt_products']

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/{code saved}/public_html/hwpt/includes/database.php on line 27

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in /home/{code saved}/public_html/hwpt/includes/database.php on line 32

Warning: Cannot modify header information - headers already sent by (output started at /home/{code saved}/public_html/hwpt/includes/database.php:22) in /home/{code saved}/public_html/hwpt/html/header.php on line 6

Thx
Henk

Submitted by support on Mon, 2013-03-25 11:03

Ah Sorry Henk, I mis-read the original error.

It will be because the IGNORE INDEX clause is not required with your current database configuration (it will be mod rather than distribution related).

To fix, simply edit your search.php, search for

IGNORE INDEX (name_2)

...and DELETE, making sure to leave spaces either side of it in the remaining SQL, and that should be all it is...

Cheers,
David.
--
PriceTapestry.com

Submitted by henk on Mon, 2013-03-25 12:30

Sorry David,

That line is not in search.php

Thx
Henk

Submitted by support on Mon, 2013-03-25 12:40

Hi Henk,

Sorry about that - please could you email me the example page showing the error, and also search.php and products.php and I'll check it out...

Cheers,
David.
--
PriceTapestry.com