echo不返回结果

I have some php code, where I have made a MySQL database with some informations. When I run my code I get this answer: "Connected to MySQL", but the page does not return my ID, name and year. Can anybody see why that is?

Best Regards Mads

<?php
//echo phpinfo();

$username = "root";
$password = "root";
$hostname = "127.0.0.1:8889"; 

//connection to the database
$dbhandle = mysql_connect($hostname, $username, $password) 
 or die("Unable to connect to MySQL");
echo "Connected to MySQL<br>";


//select a database to work with
$selected = mysql_select_db("examples",$dbhandle) 
  or die("Could not select examples");

//execute the SQL query and return records
$result = mysql_query("SELECT id, model, year FROM cars");

//fetch tha data from the database 
while ($row = mysql_fetch_array($result)) {
   echo "ID:".$row{'id'}." Name:".$row{'model'}."Year: ".$row{'year'}."<br>"; //display the results
}
//close the connection
mysql_close($dbhandle);
?>


CREATE DATABASE `examples`;
USE `examples`;
CREATE TABLE `cars` (
   `id` int UNIQUE NOT NULL,
   `name` varchar(40),
   `year` varchar(50),
   PRIMARY KEY(id)
);
INSERT INTO cars VALUES(1,'Mercedes','2000');
INSERT INTO cars VALUES(2,'BMW','2004');
INSERT INTO cars VALUES(3,'Audi','2001');
INSERT INTO cars VALUES(4, 'Ferrari', '2013');
INSERT INTO cars VALUES(5, 'Lamborghini', '2012');
INSERT INTO cars VALUES(6, 'Mazda', '2010');

You have used braces instead of brackets in the following line:

echo "ID:".$row{'id'}." Name:".$row{'model'}."Year: ".$row{'year'}."<br>"; //display the results

Change it to:

echo "ID:".$row['id']." Name:".$row['model']."Year: ".$row['year']."<br>"; //display the results

Found the answer. I have written model instead of name:-)

<?php
//echo phpinfo();

$username = "root";
$password = "root";
$hostname = "127.0.0.1:8889"; 

//connection to the database
$dbhandle = mysql_connect($hostname, $username, $password) 
 or die("Unable to connect to MySQL");
echo "Connected to MySQL<br>";


//select a database to work with
$selected = mysql_select_db("examples",$dbhandle) 
  or die("Could not select examples");

//execute the SQL query and return records
$result = mysql_query("SELECT id, name, year FROM cars");

//fetch tha data from the database 
while ($row = mysql_fetch_array($result)) {
   echo "ID:".$row{'id'}." Name:".$row{'name'}."Year: ".$row{'year'}."<br>"; //display the results
}
//close the connection
mysql_close($dbhandle);
?>