Web lists-archives.com

Re: [PHP] Simple PHP Insert Page has Random Failure with MySQL





> Date: Friday, March 18, 2016 08:10:22 -0700
> From: dealtek@xxxxxxxxx
>
> Hi all,
> 
> I was working on a very simple php page to insert a new record into
> a mysql 'contacts' table.  For testing, when I would refresh the
> page it would insert the new record.
> 
> This worked fine - MOST of the time. Then, oddly randomly it would
> stop inserting records. I would click refresh several times and no
> new records got created. Then I might quit the browser or wait a
> while etc. then reload and it would work again for a while then
> stop again...
> 
> one clue is the table looked like this with missing serial ID's:
> 
> Rec 1 - fields...
> Rec 2 - fields...
> Rec 3 - fields...
> Rec 7 - fields...
> Rec 8 - fields...
> Rec 12 - fields...
> Rec 13 - fields...
> Rec 14 - fields...
> 
> so it seems the page went to mysql and tried to insert a record but
> failed for some reason. Since it was static test data - it was all
> the same so it seems that can be ruled out.
> 
> Also this is a very fast server with local mysql - so that should
> not be an issue.
> 
> 
> Any idea why it might be randomly failing to insert records?
> 
>

Without any real details it's basically impossible to even guess what
the issue might be.

You should print/echo your insert statement so that you can see what
you're passing to the db. You should also turn your php error
reporting all the way up so you get notification of warnings and
errors.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php