I am getting all sorts of trouble on my web hosted account. I have about 3,500 unique visits per month and over 400,000 impressions. Each page view includes a MySQL query.
In fact, there are two queries per page.
First draws the product detail:
$sql = "SELECT * FROM products WHERE state = '$state' ORDER BY type_1, type_2, user_id";
And a second;
$sql_user_id = "SELECT * FROM users WHERE user_id ='$seller_id'";
From these queries, a display is produced.....
Phone Number, Product Type 1, Product Type 2, Quantity, Delivery
Phone number comes from the user table, and the rest comes from products table.
Here's a snapshot from the error log.
[15-Jun-2011 14:27:39] PHP Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/richard/public_html/display_detail.php on line 107
[15-Jun-2011 14:27:40] PHP Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/richard/public_html/display_detail.php on line 107
[15-Jun-2011 14:27:41] PHP Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/richard/public_html/display_detail.php on line 107
[15-Jun-2011 14:27:49] PHP Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/richard/public_html/display_detail.php on line 107
[15-Jun-2011 15:02:04] PHP Warning: mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Too many connections in /home/richard/public_html/cgi-bin/conn_string.inc on line 13
[15-Jun-2011 15:02:13] PHP Warning: mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Too many connections in /home/richard/public_html/cgi-bin/conn_string.inc on line 13
[15-Jun-2011 15:02:16] PHP Warning: mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Too many connections in /home/richard/public_html/cgi-bin/conn_string.inc on line 13
[15-Jun-2011 15:02:20] PHP Warning: mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Too many connections in /home/richard/public_html/cgi-bin/conn_string.inc on line 13
There might be over 200 of those last. I guess thats where the server just stopped processing.
Is the problem in my queries or should they be joined? Is this a DOS attack? Is the web hosting solution too underpowered? My host company has taken to shutting me down unless I get this sorted out.
TIA,
John
There might be 60 of these in sequence within seconds of each other.