For Programmers: Free Programming Magazines  


Home > Archive > PHP Programming > February 2005 > mysql_affected_row return 0 ???









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author mysql_affected_row return 0 ???
Bob Bedford

2005-02-28, 8:56 am

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

2005-02-28, 8:55 pm


> 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 ?


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


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com