Re: How can I get the number of entries retrieved by a "SELECT - FROM"
| From: | Becoming Digital | Date: | Thu, 12 Jun 2003 22:21:02 +0000 |
| Subject: | Re: How can I get the number of entries retrieved by a "SELECT - FROM" | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-28590@lists.php.net to get a copy of this message | ||
> The PHP "SELECT FROM" below (before snip) listed the expected data.
> Is there a way to get the digit "3" into a PHP variable
$data = mysql_result($result,1,"name"));
> How do I trap or collect or save the digit "3" generated the
> mysql "SELECT COUNT(*)" statement below?
Same as above. Store it in a PHP variable and retrieve it later.
Edward Dudlik
Becoming Digital
www.becomingdigital.com
----- Original Message -----
From: "ed anderson" <dander@bestweb.net>
To: <php-db@lists.php.net>
Sent: Thursday, 12 June, 2003 17:58
Subject: [PHP-DB] 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
Dander@bestweb.net
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php