Ok, thanks for that...
So far I have made a practice database with a table called "grocery_inventory". It's a tiny database and the table is very small with five columns called "id, name, description, price and quantity". There are only a few items on this table such as "apples" "bananas" and so on.
Anyway... like I say... so far I know how to call up the items on this database and display them as text, but I don't know how to put them into a nice neat looking table.
Here is the code I have so far:
<?php
// open the connection
$conn = mysql_connect ("localhost", "root", "");
// pick the database to use
mysql_select_db ("dcdatabase",$conn);
// create the sql command
$sql = "Select * from grocery_inventory";
// execute the sql command
$result = mysql_query($sql, $conn) or die (mysql_error());
// go through each row and display data
while ($shit = mysql_fetch_array($result)) {
// give a name to the fields
$id =$shit['id'];
$name = $shit['item_name'];
$desc = $shit['item_desc'];
$price = $shit ['item_price'];
$qty = $shit ['curr_qty'];
//print the results on screen
echo "The ID is $id and the text is $name <br>";
echo "The description is $desc and the price is $price <br>";
echo "The current quatity for this item is $qty<br>";
print "<br>";
print "<br>";
}
?>
When I use the above code I get a plain html page which says the following:
The ID is 1 and the text is Apples
The description is Medium-sized Granny Smith and the price is 0.25
The current quatity for this item is 1000
The ID is 2 and the text is Buches of Grapes
The description is Seedless grapes and the price is 0.99
The current quatity for this item is 500
The ID is 3 and the text is Bottled Water (6 pack)
The description is 500ml spring water. and the price is 0.99
The current quatity for this item is 250
The ID is 4 and the text is Pineapple
The description is A big one and the price is 1.25
The current quatity for this item is 500
The ID is 5 and the text is Oranges
The description is Lots of seeds and sour and the price is 0.52
The current quatity for this item is 750
The ID is 6 and the text is Pint of Milk
The description is nearly out of date and the price is 0.85
The current quatity for this item is 80
...so as you can see, I've got a long way to go before that turns into a table!
David
PS- My database is called "dcdatabase" and I'm just using the server on my computer at home (i.e. localhost)