All right,
Let's say that you have a table that has fields id, name and description...
This is what you do...
<?
$table="yourtable";
$connection=mysql_connect("host", "user", "password");
$db=mysql_select_db("yourdatabase", $connection);
//your query
$sql="select * from $table";
$result=mysql_query($sql, $connection);
//initialize three arrays
$id=array();
$name=array();
$description=array();
//start while loop to store results of a query into arrays
while($res=mysql_fetch_array($result))
{
$id[]=$res["id"];
$name[]=$res["name"];
$description[]=$res["description"];
}
//start for loop to retrieve data from arrays
for($i=0; $i<count($id); $i++)
{
//retrieve data
echo "$id[$i]<br>";
echo "$name[$i]<br>";
echo "$description[$i]<br>";
}
?>
That's the code. Of course you can embed while loop into for loop and you can embed html tags into echo statements in the for loop to arrange it in right order
like
echo "<table border=2>";
echo "<th>ID</th><th>NAME</th><th>DESCRIPTION</th>";
for($i=0; $i<count($id); $i++)
{
echo "<tr>";
echo "<td>$id[$i]</td><td>$name[$i]</td><td>$description[$i]</td>";
echo "</tr>";
}
echo "</table>";
That's it for now... Next time browse around the web there are plenty of articles that describe that. PHPBuilder.com, Devshed.com. Or check some books like "Professional PHP Programming", "PHP Fast & Easy"...
Good luck,
Di