Whether you can select into an array directly depends on your database.

In any case, PHP executes database queries and returns a handle or 
container which is accessed as an array.
Here's the example from

mysql_connect($host, $user, $password);
$result = mysql_query("select user_id, fullname from table");
while ($row = mysql_fetch_array($result)) {
     echo "user_id: ".$row["user_id"]."<br>\n";
     echo "user_id: ".$row[0]."<br>\n";
     echo "fullname: ".$row["fullname"]."<br>\n";
     echo "fullname: ".$row[1]."<br>\n";

If you want a tutorial on this, Julie Meloni has some really good examples 
at and there are others at DevShed and WebMonkey.

Cheers - Miles

At 02:42 PM 1/16/2002 +0200, George Lioumis wrote:
>Hello everyone!
>I have the following table:
>I do a select: "SELECT n_name from name" and  I want to put all selected 
>"n_name" values into an array (say it names)
>How can this be done??
>Thanx in advance.

PHP Database Mailing List (
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to