Hi again hiptobesquare, good to see you're carrying on learning PHP!
An array, in very simple terms, is a collection of variables placed into one big variable! But an array isn't simply just that. The PHP manual explains array's as being a map, which is probably a good way to explain the complexity of them.
For example, an array can simply have data (simply information that makes no sense if viewed, because it hasn't been placed with anything), so if i had a shopping list this would be perfect:
- Apples
- Banana's
- Bacon
- Cheese
- etc
To call these values, php assigns numbers to the values, starting from 0. Lets say our variable is called $shoppinglist. So to extract Apples, we do $shoppinglist[0]; and Bacon is $shoppinglist[2]; But what if we needed more than one pack of bacon?
You can get an ordered array, with keys which gives us order to the data!
- [apples] 1
- [banana] 2
- [bacon] 2
- [cheese] 1
To read up further you need to looke at the PHP Manual
To fix you're problem though, we need to extract the information from the array:
PHP Code:
<?php
session_start();
?>
<html>
<head>
</head>
<body>
<?php
$user="root";
$host="localhost";
$password="";
$connection = mysql_connect($host,$user,$password)
or die ("couldn't connect to server");
$db = mysql_select_db("doorstop")
or die ("couldn't locate the database");
$query = "SELECT * FROM price WHERE glass='$_SESSION[door1glass]'";
$result = mysql_query($query)
or die("Query failed: " . mysql_error());
while ( $row = mysql_fetch_array($result) ) {
echo('Value: ' . $row[0] . '<BR>');
}
?>
</body>
</html>
__________________
A lie gets halfway around the world before the truth has a chance to get its pants on. - Sir Winston Churchill
Please visit my sites: Please login or register to view this content. Registration is FREE | Please login or register to view this content. Registration is FREE
|