I recently exeprienced and isolated insert failuer on my mysql server. I
have a PHP script that contains a simple insert statement like the one below
<?php
$insert = "insert into tbl_name values ('', 'test')";
mysql_query($insert,$link) or die(mysql_error()."<br>".$insert);
?>
Here's the problem. The insert failed but the script didn't die. I know
it's not a case of duplicate keys. And it's an isolated case. This page
gets 100 hits a day w/o an incidents like this before or since. Does
anyone have any ideas why this may have happened? Does anyone have any
idea how to prevent this from happening in the future? The engine for the
table is MyISAM so I can't use transactions.
Thanks for any suggestions you may have.
David Harper - 28 Apr 2005 12:36 GMT
> Here's the problem. The insert failed but the script didn't die. I know
> it's not a case of duplicate keys. And it's an isolated case. This page
> gets 100 hits a day w/o an incidents like this before or since. Does
> anyone have any ideas why this may have happened? Does anyone have any
> idea how to prevent this from happening in the future?
How do you know that the insert is failing, if your script doesn't die?
What error message, if any, are you getting?
Is there anything that makes the failed cases different from the
successful ones? Think, please! Anything at all?
Have you tried switching on query logging on your MySQL server, so see
what queries are actually being sent to the server (as distinct from
what you think your PHP script is sending, which may not be what it is
actually sending!).
Is the disk containing your MySQL server's data directory full? Is it
shared with other users who may fill it occasionally, then delete files?
If your PHP script attempts an insert, and the disk is full, then the
insert will fail. The next attempt may be successful, if someone else
has deleted files in the interim.
David Harper
Cambridge, England
kaeli - 28 Apr 2005 13:30 GMT
> I recently exeprienced and isolated insert failuer on my mysql server. I
> have a PHP script that contains a simple insert statement like the one below
[quoted text clipped - 6 lines]
>
> Here's the problem. The insert failed but the script didn't die.
I had that happen when I had a check for a URL variable being defined (before
the insert), and it wasn't. The script gave no errors, but no insert took
place, either.
Just a thought. The error might have not had anything to do with the SQL.

Signature
--
~kaeli~
If at first you don't succeed, skydiving is not for you.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace