Re: Slecting data
| From: | Brian Rue | Date: | Wed, 11 Oct 2000 03:48:00 +0000 |
| Subject: | Re: Slecting data | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-19479@lists.php.net to get a copy of this message | ||
Try using mysql_numrows:
$query="SELECT id FROM table";
$result=mysql_query($query,$connection);
$numrows=mysql_numrows($result);
$query="SELECT * FROM table WHERE id=$numrows";
$result=mysql_query($query,$connection);
That might not be the best way to do it, but it should work.
----- Original Message -----
From: <Website4S@aol.com>
To: <php-general@lists.php.net>
Sent: Tuesday, October 10, 2000 8:03 PM
Subject: [PHP] Slecting data
Hi,
I`m new to this list and fairly new to PHP, just wondering if anyone can
help
me with this problem.
I`m trying to select data from a table which I can normally do no probs, but
this time I`m having to display the last entry using the Where statement but
I`m not sure what to write after this to make sure it picks up the highest
number. I`m using the following:
$sql = "SELECT * FROM UKGSSegaNews WHERE ID='????'";
I have ID setup in the database table as Primary Key and auto incrementing
so
I always need to pick up the highest numbered record. Can anyone help me
with
this snippet of code??
Ade
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net