Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

error checking on php insert statement 1

Status
Not open for further replies.

FNBIT

IS-IT--Management
Oct 27, 2006
74
US
I have an insert statement that is not working. Everything looks good but is there a way I can get a verbose error message on this so I can track down the problem?

I am not sure if it is possible to use too many SQL statements. I have one that pulls info from a database then goes through each record, checks some values from another table (same database) does a compare and if it is an updated value insert it back into this table. If it is not that, it is probably a datetime insert. I have a string that is in the correct MySQL form (ie '2009-12-20 09:14:22') that may not be working. I would like to find out why it is not inserting but I cannot find any hints through my Google searches. I did try to turn on my error checking on the server but it gives me some warnings but no error messages pertaining to this problem.

My server is a Windows 2003 server running IIS with PHP installed. I would have to check exact versions if anybody thinks that info is relevent.

Thanks and Happy Holidays to everybody!
 
Assuming you are using normal mysql calls you can ask mysql to retunr a more meaningful error:

$qry="INSERT ....";
$result=mysql_query($qry) [red]or die(mysql_error());[/red]

This should spit out something more useful.

You could also echo out the query and try to run it through a mysql GUI such as MYSQL's Query Browser and see if it produces any useful errors.

----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Thank you! It was something really stupid on my part but I kept over looking it and focused on the more complicated part. The error it spit out told me exactly what I needed to know.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top