Here's a little function I've been using for a while now, pass it two parameters (action command (1 or 0 see notes)) and a sql statement.
It returns a simple line which shows the length of time taken to action the query, the status of the query (0= query not actioned, you can set this value for testing, 1=success qry executed successfully, -1= failed, there was a problem with the sql statement) the number of lines affected by that query and the sql statement itself.
I've found this invaluable when trying to tie down large amounts of updates to a table, using this you can easily see where a query was successfully executed and the number of rows are affected, or where there are problems and a statement has failed for example.
$start = getmtime();
$result = mysql_query($sql);
$affectedrows = "[".mysql_affected_rows($link)."]";
return "[".number_format((getmtime()-$start),3)."][$action]: $sql\n";
[0.072]: UPDATE MYTABLE SET FIELD = 1;
[0.106]: UPDATE ANOTHERTABLE SET FIELD = 2;
[0.006][-1]: UPDATER ANOTHERTABLE SET FIELD = 2;
The output shows:
The result will be either -1, 0 or 1, -1 means there's a problem with the sql statement, 1 means it executed correctly, 0 means it wasn't executed.