RE: [PHP] Select
| From: | Jon Farmer | Date: | Tue, 14 Aug 2001 15:00:48 +0000 |
| Subject: | RE: [PHP] Select | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-62646@lists.php.net to get a copy of this message | ||
thats because mysql_fetch_row only returns one row.
to get all the rows do
while ($row = mysql_fetch_array($result) {
//processing code here
}
This will run through all the rows putting the colums into the array $row[]
Regards
Jon
--
Jon Farmer
Systems Programmer, Entanet www.enta.net
Tel 01952 428969 Mob 07968 524175
PGP Key available, send blank email to pgpkey@bctech.co.uk
-----Original Message-----
From: Jeremy Morano [mailto:jeremy@prepresshelp.com]
Sent: 14 August 2001 15:53
To: php-general@lists.php.net
Subject: [PHP] Select
Hi,
I'm having a problem with my Select statement. This is what i'm doing:
$connection = @mysql_connect("l", "c", "c") or die("Couldn't
connect.");
$db = @mysql_select_db($db_name, $connection) or die("Couldn't select
database.");
$sql =" SELECT *
FROM table_1
";
$result = @mysql_query($sql,$connection) or die("Couldn't execute query.");
$data=mysql_fetch_row($result);
$count=$data[0];
echo $count;
Yet the only result I get is the first value of the first
column.............
--
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