View Single Post
Old 06-18-2007, 01:53 AM   #20 (permalink)
Salchester
Salchester
 
Salchester's Avatar
 
Join Date: Jul 2005
Location: In a house
Posts: 230
Salchester is an unknown quantity at this point
Insert Table Data into Array

DJMaze,

The following code doesn't work, nothing gets display from the database.
Why is this?

Code:
<?php

$con = mysql_connect("localhost","peter","abc123");
if (!$con)
{
  die('Could not connect: ' . mysql_error());
}

mysql_select_db("WB", $con);

$result = mysql_query("select * from Birds");

// alternatively, you could use mysql_fetch_assoc if you wanted
// the array to be keyed by the field name
while ($array = mysql_fetch_assoc($result))
{
  echo $array[0]['Name'];
} 

?>
Many Thanks,
__________________
Many Thanks, in advance!

Salchester.
The Future Is Here - Are You Ready?
Salchester is offline   Reply With Quote