Connecting Tech Pros Worldwide Forums | Help | Site Map

mysql_affected_row return 0 ???

Bob Bedford
Guest
 
Posts: n/a
#1: Jul 17 '05
I've this code:

if(mysql_query("delete from emails where email = '$email'",$mydatabase)){
if(mysql_affected_rows()>0)
echo('successfull');

This code seems ok, but even if the query works fine (the email line is
deleted from the mysql database), the mysql_affected_rows is 0

My config: XP, apache, PHP 4.3.10, mysql 4.1.10

What's wrong with my code ?


Anthony Houghton
Guest
 
Posts: n/a
#2: Jul 17 '05

re: mysql_affected_row return 0 ???


[color=blue]
> I've this code:
>
> if(mysql_query("delete from emails where email = '$email'",$mydatabase)){
> if(mysql_affected_rows()>0)
> echo('successfull');
>
> This code seems ok, but even if the query works fine (the email line is
> deleted from the mysql database), the mysql_affected_rows is 0
>
> My config: XP, apache, PHP 4.3.10, mysql 4.1.10
>
> What's wrong with my code ?[/color]

Try
$result = mysql_query("delete from emails where email =
'$email'",$mydatabase);
if (mysql_affected_rows($result)>0)
echo('successfull');
--
Ant


Closed Thread