Change you SQL statement as follows.

"SELECT Count(*) as Cnt FROM...."

Then use "Cnt" as your "variable" like you would "h_id"

Roger. 

> -----Original Message-----
> From: ed anderson [mailto:[EMAIL PROTECTED]
> Sent: Thursday, June 12, 2003 5:58 PM
> To: [EMAIL PROTECTED]
> Subject: How can I get the number of entries retrieved by a "SELECT -
> FROM"
> 
> 
> Dell 4500, mem 1g, disk 45g, mhz 2g, Mysql-3.23.54a-linux-i686, PHP-4.30,
> httpd_2.0.44
> 
> 
> 
> 1. How do I trap or collect or save the digit "3" generated the
>    mysql "SELECT COUNT(*)" statement below? 
>    
> 2. The PHP "SELECT FROM" below (before snip) listed the expected data.
>    Is there a way to get the digit "3" into a PHP variable?
> 
> SELECT h_id, name FROM tbtm # displays
>   WHERE h_id="1"                # three
>      OR h_id="2"                   # lines
>      OR h_id="3";              # of data
> 
> SELECT COUNT(*) FROM tbtm   # displays
>   WHERE h_id='1'            # the
>      OR h_id='2'            # digit
>      OR h_id='3';           # three
> 
> +----------+
> | COUNT(*) |
> +----------+
> |        3 |
> +----------+
> 1 row in set (0.00 sec)
> 
> 
> 
>  The next PHP is the same as the "SELECT FROM" above.
> <?php
>  $result = mysql_query(" SELECT h_id, name, FROM tbtm
>       WHERE h_id='1'
>          OR h_id='2'
>          OR h_id='3'",
>      $tmtb_db);
> #
>  printf("ID: %s<br>\n",      mysql_result($result,1,"h_id"));
>  printf("name: %s<br>\n",    mysql_result($result,1,"name")); 
>  <snip>   <snip>
> #
> ?>
> 
> 
> Thanks
> 
> [EMAIL PROTECTED]
> 
> 
> 
> -- 
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    
> http://lists.mysql.com/[EMAIL PROTECTED]
> 

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to