[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Strange COUNT results


There's probably something wrong with your PHP code. It should look something 
like...

$result = mysql_query("select count(*) as cnt from table") or die 
(mysql_error());
$row = mysql_fetch_array($result);
$count = $row[cnt];
print $count;

Sounds like you're doing something more like:

$result = mysql_query("select count(*) as cnt from table") or die 
(mysql_error());
print $result;

On Monday 26 November 2001 03:43 pm, Cory Gagliardi wrote:
> I'm using PHP with mySQL and I got very weird results when I ran a count. 
> I used "SELECT COUNT(*) FROM $TableName", with $TableName being my table's
> name, for the Query.  When I printed the result I got "Resource id #2",
> what does that even mean.  And what did I do wrong?....
>
>
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
> To request this thread, e-mail <mysql-thread92269@xxxxxxxxxxxxxxx>
> To unsubscribe, e-mail
> <mysql-unsubscribe-ken=notenetwork.com@xxxxxxxxxxxxxxx> Trouble
> unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <mysql-thread92281@xxxxxxxxxxxxxxx>
To unsubscribe, e-mail <mysql-unsubscribe-treed=ultraviolet.org@xxxxxxxxxxxxxxx>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



This mailing list archive is a service of Copilot Consulting.