Re: Mysql gives error except code executes correctly!?!
| From: | Mukul Sabharwal | Date: | Mon, 20 Nov 2000 12:51:45 +0000 |
| Subject: | Re: Mysql gives error except code executes correctly!?! | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-26251@lists.php.net to get a copy of this message | ||
Hi,
If you've done this ...
$update = update("UPDATE tablename SET ...");
and then done mysql_fetch_array() or mysql_fetch_row()
or whatever... then it'll give an error, UPDATES and
INSERTS can only show if it succeeded (1) or failed
(0).
Oh... and also anything like
mysql_affected_rows($update) won't work either..
--- Noah Spitzer-Williams <noahsw@cyberdude.com>
wrote: > Hey guys, i have the following code for
updating
> votes in a database:
>
> $uv = "v".$rating."=v".$rating."+1";
> $usex = "sex".$csex."=sex".$csex."+1";
> $uage = "age".$cage."=age".$cage."+1";
> $urace = "race".$crace."=race".$crace."+1";
> $uloc = "loc".$cloc."=loc".$cloc."+1";
> $sql = "UPDATE pet_pics SET
> $uv,$usex,$uage,$urace,$uloc WHERE id='$id'";
> $res = mysql_query($sql);
> $arr = mysql_fetch_array($res);
>
> if i were to print the sql statement, it would read:
> UPDATE pet_pics SET
>
v1=v1+1,sexm=sexm+1,age3=age3+1,race2=race2+1,loc4=loc4+1
> where id='2'
>
> now sql says its not a valid result resource except
> when i check my
> database, the fields have been updated!
>
> anyone know whats goin on here?
>
> -Noah
>
>
> --
>
> -----------------
> The DevBoard - http://www.thedevboard.com
> -----------------
> http://www.alladvantage.com/go.asp?refid=BIY971 -
> AllAdvantage
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail:
> php-general-unsubscribe@lists.php.net
> For additional commands, e-mail:
> php-general-help@lists.php.net
> To contact the list administrators, e-mail:
> php-list-admin@lists.php.net
>
=====
To Find Out More About Me : http://mukul.tsx.org/
__________________________________________________
Do You Yahoo!?
Yahoo! Calendar - Get organized for the holidays!
http://calendar.yahoo.com/