Re: queries correctly in mysql, but not in php?

From: Pedro Graca (hexkid_at_dodgeit.com)
Date: 12/25/04


Date: 24 Dec 2004 23:17:03 GMT

Glenn wrote:
> Pedro Graca wrote:
>> Glenn wrote:
>>> $str_query = 'SELECT game, SUM(winloss), SUM(duration/60) FROM
>> ^^^^^^^^^ ^^^^^^

>>> $result = mysql_query($str_query);
>> ^^^^^^^^^^
>> So you're making a "SELECT" query

>>> echo 'DEBUG: Rows affected: '.mysql_affected_rows();
>> ^^^^^^^^^^^^^^^^^^^^^
>> And mysql_affected_rows() does not work with "SELECT" queries.

> No offense, but, no...

No offense taken, thank you for testing it for me (as I should have done
before posting).

After I read your post I performed a few tests here and reached the
conclusion that (for my version of PHP and MySQL) you are right.

However, according to the manual, that is not the way the function
"mysql_affected_rows()" works -- one of the user notes says that this
function is implemented as a macro in the source for mysql and works
like mysql_num_rows() -- I will stick with using mysql_num_rows() for
SELECT and mysql_affected_rows() for other types of queries.

... some time later ... [I didn't feel like deleting my previous comments]

Oops ... please disregard all of the above :-)

http://bugs.php.net/bug.php?id=30579
  This bug has been fixed in the documentation's XML sources. Since the
  online and downloadable versions of the documentation need some time
  to get updated, we would like to ask you to be a bit patient.

-- 
Mail to my "From:" address is readable by all at http://www.dodgeit.com/
== ** ## !! ------------------------------------------------ !! ## ** ==
TEXT-ONLY mail to the whole "Reply-To:" address ("My Name" <my@address>)
may bypass my spam filter. If it does, I may reply from another address!


Relevant Pages

  • Re: MySQL permission
    ... >> perhaps you should keep your snide comments ... it was in response to a posting of mine. ... either your version of mysql has been farked or you do not read too well. ...
    (comp.os.linux.misc)
  • apache mod perl dbi mysql : Premature end of script headers:
    ... I am posting this through groups.google.com in case anyone has the ... I am working through the early examples in "MySQL and Perl for the ... Can't connect to local MySQL server through socket ... Turns out, like in PHP, the DBI module allows us to specify the mysql ...
    (comp.lang.perl.misc)
  • RE: MySQL and .NET
    ... MySQL website only provides ODBC drivers. ... some third party companies has developed OleDb providers and .NET ... you can also try to use an .NET data provider. ... "This posting is provided "AS IS" with no warranties, ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Fehlermeldung PHP...
    ... > Ich versuche MySQL mit phpmyadmin ans Laufen zu ... dein Posting ist hier nicht richtig. ... in der es auch um MySQL und dessen Anbindung an PHP geht. ... > probably mysql.so or php_mysql.dll. phpMyAdmin tried to load the extension ...
    (de.comp.datenbanken.mysql)