View Single Post
  #7 (permalink)  
Old 01-30-04, 05:38 PM
NeverMind's Avatar
NeverMind NeverMind is offline
Community VIP
 
Join Date: Aug 2003
Location: K.S.A
Posts: 2,257
Thanks: 0
Thanked 2 Times in 1 Post
you could use mysql_affected_rows()..
something like this should do :
PHP Code:

$result mysql_query($sql); 

$num mysql_affected_rows();

if (
$num 0) {
echo(
"Successfully executed the database manipulation!");
} else {
echo
'Faild to insert the new record!';

the ones you mentioned will work all the time I assume, because if the query failed, it will return 0 (False) !
so you may want to use empty() to make sure the value of $result is neither 0 (false) nor empty ..
so something like this should work :
PHP Code:

 $result mysql_query($sql);

if (!empty(
$result))
{
echo(
"Successfully executed the database manipulation!");
###THIS AREA###
} else {
echo
'Faild to insert the new record!';

__________________
PHPSimplicity
We don't need a reason to help people - Zidane [FF9]