Pergunta

I've been having trouble with some of my sites on shared web hosting losing data bound for their respective MySQL databases. My provider doesn't provide access to the MySQL logs. They're having a server engineer look into the problem on Monday; however, I'd like to have some concrete data to illustrate the extent of the problem.

What would be a good way, preferably using PHP, to get proof showing data being dropped on its way to a MySQL database? Is there an existing tool for this kind of testing? A Drupal module would be ideal, since I could simply install that to run temporarily on one of the sites I have configured already?

p.s. - Yes, I'll be moving the sites off of shared hosting shortly. :)

Foi útil?

Solução

Find the place in your code where the insert is actioned. Ensure it has error handling. Check the return from the DB.

If the DB says it has inserted the data (e.g. returns succcess to your code) and the data is not inserted you have found a huge bug in mysql. The likelihood of this being so approaches zero (a large number of other people use the same functionality extensively and there are not widespread reports of data loss as one would expect if a common tool like mysql is failing).

Add debug lines to your code which write out to as log file the statement actioned, the result returned, and what your code does with the statement and the return result.

It all comes down to the question of how does your code handle errors and commits?

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top