Jump to content

[SOLVED] Help with error trapping and similar php+mysql


Humpty

Recommended Posts

G'day guys,

 

I am using the following code:

CODE 1

$ezusersSearchresult=mysql_query($ezusersSearchquery) or ("<BR><BR> SQL ERROR Getting Plan List 001:<BR>$ezusersSearchquery");

 

This has always done me fine right up until now.  We are going to set this file (and others) as automatic cron jobs.

 

I will need to use the following code if an error occurs.

CODE 2

$AppendToERRORLog = "There was an error ERRORDETAILS WILL BE HERE";
include ("AppendERRORLog.php");

 

Now CODE 2 works just fine, what I can't work out is how to make it work instead of the message displayed if mysql_query doesn't work and errors for whatever reason.

 

 

CODE 1 would display it on the screen (which was all well and good while i was manually running it).

CODE 2 writes info to a txt file so that I can store it and check it at a latter date.

 

Thanks in advance. - Humpty

sweeeeeeeeet!

 

That is exactly what I had been searching for.  Thankyou, thankyou and thanks.

 

Now by the same token what happens there is if it is succesfull my $result is the same as it would have been my (less helpful, more amature) original way correct?

Now by the same token what happens there is if it is succesfull my $result is the same as it would have been my (less helpful, more amature) original way correct?

 

Correct.

 

PS: (Answering one of the questions in your sig) The solved button is in the lower left corner of the thread. I'll mark this one resolved.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.