Hi Dave,
I am getting following errors on my script. I have no idea where they actually occurring? I have enabled dubbing mode, but can not see any error messages. Could you please help me to troubleshoot this?
[30-Jan-2012 10:31:32] PHP Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /path/to/public_html/includes/database.php on line 27
[30-Jan-2012 10:31:32] PHP Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in /path/to/public_html/includes/database.php on line 32
[30-Jan-2012 10:31:32] PHP Warning: Cannot modify header information - headers already sent by (output started at /path/to/public_html/includes/database.php:27) in /path/to/html/header.php on line 6
Hello Noor,
My apologies I misread the original error log; unfortunately it's not possible to add additional debug info to PHP's error log in the same way that viewing the output with database debug mode enabled is so it could be a transient error.
What I would do in this situation (as even with debug mode enabled the output may be such that it is not visible with the HTML) is to to tail the error log in terminal window using:
tail -f error_log
Then with that visible and another window showing your website; browse around and try to locate the page that generates the error - that would be the best approach. If it's not possible to locate a definite correlation I would suggest keeping an eye on the log and your site as it may have just been a transient database unavailability.
Cheers,
David.
--
PriceTapestry.com
Some how with good fortune, I have managed recreate the problem. While trying to troubleshoot exactly this problem, I have made a search for a ONE DIGIT term like http://www.bestbuyers.co.uk/search.php?q=d and guess what, I got the eaxct error I was looking for.
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/bestbuy/public_html/includes/database.php on line 27
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in /home/bestbuy/public_html/includes/database.php on line 32
Warning: Cannot modify header information - headers already sent by (output started at /home/bestbuy/public_html/includes/database.php:27) in /home/bestbuy/public_html/html/header.php on line 6
Now I have modified the noresults.php template, I have gone through this could not find anything that is out of order. I am attaching the code below, could you please double check to see that I am not blind :-(
<br />
<br />
We haven't found any product matching <? print ("$q"); ?> Please try following:<br />
<ul>
<li>Try using broader terms (e.g green apple) if you have entered very narrow (e.g small sized green apple) search terms</li>
<li>Try using narrow terms (e.g red toshiba laptop) if you have entered very broader search terms (e.g laptop)</li>
<li>Try Searching using alternative keyword that describes that product you looking for</li>
</ul>
Also try following:<br />
<ul>
<li>Look through the <a href="/category/">Categories</a></li>
<li>Search the <a href="/brand/">Brad Names</a></li>
<li>Find the by <a href="/merchant/">Retailers</a></li>
</ul>
Or could it be search.php itself....?
{code saved}
I know this can not be the header as other part of the site absolutely fine with same header.
This is very strange.
Noor
Hello Noor,
Now that you have the error occurring during a normal page view you can use database debug mode to reveal the SQL causing the error. To enable this, edit line 6 of config.advanced.php as follows:
$config_databsaeDebugMode = TRUE;
With that in place, if you could view the page again and if you're not sure from the output where the problem lies if you could copy the extended MySQL error message into a reply to this thread i'll check it out...
Cheers,
David.
--
PriceTapestry.com
Hello Noor,
Please could you email me your
html/header.php
search.php
...as attachments and I'll check that out for you...
Cheers,
David.
--
PriceTapestry.com
Hello Noor,
The database error is happening in your header; it may just be that due to the design it is not being made visible in the HTML output. Could you post the contents of your html/header.php (i'll remove before publishing your reply) and I'll take a look at what SQL is being generated...
Cheers,
David.
--
PriceTapestry.com