View Single Post
Old 06-13-2007, 10:41 PM   #1 (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

Hi Everyone,

I'm currently using the following code to insert information into a database using a form. How can all this information be selected from the table and inserted into an Array.
Code:
<?php
$con = mysql_connect("localhost","peter","abc123");
if (!$con)
{
  die('Could not connect: ' . mysql_error());
}

mysql_select_db("WB", $con);

$sql="INSERT INTO Birds (Name, Species, Sex)
VALUES
('$_POST[Name]','$_POST[Species]','$_POST[Sex]')";

if (!mysql_query($sql,$con))
{
  die('Error: ' . mysql_error());
}
echo "1 record added";

mysql_close($con)
?>
Resulting in each record having its own "numeric array store" starting at 0

Quote:
$array[0] = "Joe";
Many Thanks,
__________________
Many Thanks, in advance!

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