Hi all,
I'm VERY new to php, and I'm trying to write a simple code that would get data from a table to display in a web page.
This is my first try, and I think if I can get this one to work, I'll be able to generate the proper pages I need.
I get this error message:
Parse error: syntax error, unexpected $end in /home/cuestore/public_html/testing.php on line 39
Here is the code:
<html>
<head>
<title>Test PHP</title>
</head>
<body>
<table border=1>
<tr>
<th>Name</th>
<th>Age</th>
<th>Height</th>
</tr>
<?php
include('db_login.php');
$connection = mysql_connect($db_host, $db_username, $db_password);
if (!$connection){
die ("Could not connect to the database: <br>". mysql_error());
}
$db_select = mysql_select_db($db_database);
if (!$db_select){
die ("Could not select the database: <br>. mysql_error());
}
$query = 'SELECT * FROM people WHERE 1 LIMIT 0, 30 ';
$result = mysql_query($query);
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)){
$nom = $row[name];
$annee = $row[age];
$hauteur = $row[height];
echo '<tr>';
echo '<td>$nom</td>';
echo '<td>$annee</td>';
echo '<td>$hauteur</td>';
echo '</tr>';
}
mysql_close($connection);
?>
</table>
</body>
</html>
You will notice there is no line 39...
I appreciate your help!