Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Databases / April 2005

Tip: Looking for answers? Try searching our database.

Mysql Insert Failure

Thread view: 
Jason Daingerfield - 28 Apr 2005 03:28 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

<?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



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.