note 45757 added to function.mysql-fetch-assoc
| From: | moverton at northshropshiredc dot gov dot uk | Date: | Fri, 17 Sep 2004 12:27:53 +0000 |
| Subject: | note 45757 added to function.mysql-fetch-assoc | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-76876@lists.php.net to get a copy of this message | ||
Actually, Olivier, you're completely wrong about that, because there's a bug in your
sample code. It will indeed return $row['MAX(time)'] - you have to pass the MySQL resource
to mysql_fetch_assoc() and you're not doing that. This:
$row = mysql_fetch_assoc($conn)
...where $conn is your DB connection, would in fact produce a result. The complete example below is
taken from my own self-written content management system:
$query = 'SELECT MAX(ctRevDate) FROM content group by ctPage';
$querySet = mysql_query($query, $conn);
$row = mysql_fetch_assoc($querySet);
print_r($row);
This produces:
Array
(
[MAX(ctRevDate)] => 2004-01-15
)
..on my testbed. So it doesn't in fact need an alias at all.
----
Manual Page -- http://www.php.net/manual/en/function.mysql-fetch-assoc.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+45757
Delete -- http://master.php.net/manage/user-notes.php?action=delete+45757&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+45757&report=yes
Search -- http://master.php.net/manage/user-notes.php