I want to set a variable to the value of the line number it appears in. I found an XML parser function in php but can't find one for PHP.
This would make identifying SQL errors easier, as I could get PHP to display the line number the SQL error is on as it dies
TIA
Julia
If you are using MySQL - use mysql_error() does a good job...
it doesn't seem to display the php line number, just the nature of the error, which in a long script can prove a bit tricky to find
Assuming that you don't have infinite numbers of queries the same... how about:
$query=mysql_query($somequery) or die("Error with $somequery ".mysql_errno().":".mysql_error());
Searching for a full query would be easier...
good idea, that would give something much easier to find
Thank you!
Don't forget to take these out afterwards as showing your database structure to users when a query fails is a security risk.