Justtechjobs.com Find a programming school near you






Online Campus Both


php-db | 2001011

[PHP-DB] Re: [PHP] Re: [PHP-DB] Easy MySQL question From: Paul DuBois (paul <email protected>)
Date: 01/12/01

At 10:10 AM -0500 1/12/01, Leonard T. Harris wrote:
>What's wrong with
>
>$number=mysql_num_rows($result);
>echo "The total number of rows is $number";

Primarily that mysql_num_rows() tells you how many rows are in the
result set, which for the query in question, is 1. The *content*
of that row is how many rows are in the table.

>
>
>----- Original Message -----
>From: Julie Meloni <julie <email protected>>
>To: Paulson, Joseph V. "Jay" <jay.paulson <email protected>>
>Cc: <php-general <email protected>>; <php-db <email protected>>
>Sent: Thursday, January 11, 2001 11:17 AM
>Subject: [PHP] Re: [PHP-DB] Easy MySQL question
>
>
>> Paulson, Joseph V. \"Jay\" wrote:
>>
>> > Hello everyone--
>> > I've got a easy question that I can't seem to answer for myself. I'm
>> > running a query in MySQL and want to know how many entries are in a
>table
>> > and then echo that out onto a page. I thought this would be easy but I
>> > don't know why it's not working. Anyway, here's what I am doing:
>> >
>> > (open db connection)
>> >
>> > $query = "SELECT count(*) FROM Movie";
>> > $result = mysql_query($sql, $dbLink);
>> > $myrow = mysql_result($result);
>> > echo $myrow;
>> >
>>
> > $myrow = mysql_result($result,0,"count(*)");

-- 
Paul DuBois, paul <email protected>

-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe <email protected> For additional commands, e-mail: php-db-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>