Jeremy,
The reason you are only getting the first value is because you are only
retrieving the first value and assigning it to $data. You need to step
through the result and do something with it. For example,
if ($row = mysql_fetch_array($result)) {
do {
$data1 = $row["mycolumn1"];
$data2 = $row["mycolumn2"];
} while ($row = mysql_fetch_array($result));
// more code
}
Alternatively, you could insert the values into a multidimensional array
inside the loop, so you don't have to hardcode the columns. It's up to you.
Johan Alfredeen
pongworld.com
-----Original Message-----
From: Jeremy Morano [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 14, 2001 8:53 AM
To: [EMAIL PROTECTED]
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]