Error details in php

hi all

i get error message “not updated”


if(mysql_query($qry))
{
$msg = "updated";
}
else
{
$msg = "not updated";
}

But this code doesnt let tell me what and where the problem is.

so i would like to know where should i put the below code on my page
(Before calling db_connection file or after calling db_connection file)


error_reporting(E_ALL);

so that it tell me details of error.

vineet

You need to call [fphp]mysql_error[/fphp] since your error is with mysql and not directly with PHP

thanks cp

but just for my information where do we insert error_reporting(e_all)
before call db_conection or after db_conection code

vineet

error_reporting(e_all) would be at the top of your script, but that only enables PHP driven errors to be reported.

You would use mysql_error in your else statement.

if(mysql_query($qry)) 
{ 
$msg = "updated"; 
} 
else 
{ 
$msg = "not updated" . mysql_error($conn);  //where $conn is your connection to mysql
}