I don't know basically have totally skipped something here and so i am asking, to hopefully be a better person. And So I already now, request for forgiveness for my stupidity, if any.

I've got a client that's located by company that now's accusing the web site I have build for that client, for "crashes" (or at best which makes it run very slow) the server again and again again. With no this isn't an enormous website with any complex script. It's a blog, with comment functions.

They let me know this is actually the problem, because from logs there appears to become just one problem:

world wide web.xxxxxx.se xxx.xxx.xx.xxx [14/Marly/2011:05:08:02 +0100] fcgi_php_error:PHP Warning: mysql_query() [function.mysql-query]: Not able in order to save result occur /home/t/xxxxx/world wide web/include/php/newsfeed_full.php online 66, PHP Warning: mysql_fetch_assoc(): provided argument isn't a valid MySQL result resource in /home/t/xxxxx/world wide web/include/php/newsfeed_full.php online 68

Line 66:

$sql = "Place INTO `newsfeed_comments` (publish_id, reply_id, date, title, text) VALUES ('".mysql_real_escape_string($publish_id)."', '".mysql_real_escape_string($_Publish['reply_id'])."', '".date('YmdHis')."', '".mysql_real_escape_string($_Publish['name'])."', '".mysql_real_escape_string($_Publish['text'])."')"

mysql_query($sql) or die(mysql_error())

$sql output:

Place INTO `newsfeed_comments` (publish_id, reply_id, date, title, text) VALUES ('168', '111194', '20110322145339', 'Test 2', 'Test text 2')

Line 68:

$sql = "Choose * FROM `newsfeed_comments` WHERE `post_id` = '".$publish_id."' &lifier&lifier `reply_id` IS NULL ORDER BY `date` DESC"

$result = mysql_query($sql)

$i =

while ($row = mysql_fetch_assoc($result)) and so forth...

$sql output:

Choose * FROM `newsfeed_comments` WHERE `post_id` = '168' &lifier&lifier `reply_id` IS NULL ORDER BY `date` DESC

Issue is that, I have not seen these error myself from testing. I have not had the opportunity to duplicate the errors, by any means. So it's clearly working.

My real question is, what is wrong? The webhost just informs me that I have to make certain my script are designed for all of the possible errors their server might hand out.

Same script runs perfectly on 10-15 other hosts with no problems and I have not had any issues with them.

Am I missing anything crucial? Have i got a sizable understanding gap if this involves PHP?

Possibly he's Alerts switched on on his machine, this arenĀ“t errors, php informs you some Alerts. See http://php.internet/manual/en/function.error-confirming.php

This error is typical whenever a table is corrupted. You should attempt "repairing" the table either using phpMyAdmin underneath the Procedures tab or In my opinion you are able to operate a query like "repair table newsfeed_comments".


Maybe there's an advantage situation in which the sql statement you build is invalid. Try taking the mistake on the watch's screen or log file.

$sql = "Choose * FROM `newsfeed_comments` WHERE `post_id` = '".$publish_id."' &lifier&lifier `reply_id` IS NULL ORDER BY `date` DESC"

$result = mysql_query($sql) or error_log(mysql_error())

Possibly its a memory allocation error. Would you reboot your MySQL server instance?

You are able to handle the mistake and perform some debugging by wrapping the while loop within an if ($result) statement. Look at your script's memory usage with memory_get_usage() as well as your memory limit with ini_get('memory_limit')

$sql = "Choose * FROM `newsfeed_comments` WHERE `post_id` = '".$publish_id."' &lifier&lifier `reply_id` IS NULL ORDER BY `date` DESC"

echo "Memory limit: " . ini_get('memory_limit')

echo memory_get_usage()

$result = mysql_query($sql)

echo memory_get_usage()

if ($result)