
December 26th, 2012, 05:21 PM
|
 |
JavaScript is not spelt java
|
|
Join Date: Feb 2011
Location: Landan, England
|
|
The docs have the answer:
Quote: | mysql_fetch_array — Fetch a result row as an associative array, a numeric array, or both |
To retrieve all values in the column you have to loop through them. Example (again from the docs):
PHP Code:
<?php
mysql_connect("localhost", "mysql_user", "mysql_password") or
die("Could not connect: " . mysql_error());
mysql_select_db("mydb");
$result = mysql_query("SELECT id, name FROM mytable");
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
printf("ID: %s Name: %s", $row[0], $row[1]);
}
mysql_free_result($result);
?>
You will need to modify this (or similar examples) to store the column values in a PHP array.
NB The mysql extension is deprecated and "will be removed in the future".
|