How can I get the number of entries retrieved by a "SELECT - FROM"

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

 



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

Dander@bestweb.net


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux