So I have this code in a php file:
$query="INSERT INTO tec (name) VALUES ('$name')";
$done=mysql_query($query);
if($done == 'null') {
$output = json_encode(array('type'=>'error', 'message' => $mess['error'].$done.'</b></div>'));
} else {
$output = json_encode(array('type'=>'success', 'message' => $mess['success']));
}
It inserts a name into a table named "tec". If $done == 'null'
then I print an error message.
The problem is that when I run the code, it inserts the data correctly, but I get the error message.
I tried to read $done
and its equal to 1.
Should I do something like:
if($done == 1){
//OK
}else{
//NOT OK
}
Or is there any way to fix this?