Ok guys I'm new to all this... So I read a tutorial on using Xammp for creating a Database and later writing a PHP function to access the database. So i made the database with PHPMyAdmin and all is fine. Now the tutorial had said take this code (see below) and save it as address in xampp/htdocs which I did
<? php
mysql_connect("localhost","root",""); //............line 2
mysql_select_db("addressbook");
// Run a Query
$result = mysql_query("SELECT * FROM colleague");
?>
<html>
<head>
<title> PHP Address Book Example </title>
</head>
<body>
<h1> Address Book </h1>
<table border="1" cellpadding="3" cellspacing ="0">
<tr>
<th> ID </th>
<th> Name </th>
<th> Adrress </th>
<th> Telephone </th>
<th> Email Address </th>
</tr>
<?php
//loop though all the records
while ($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['id'] . "</td>";
echo "<td>" . $row['Name'] . "</td>";
echo "<td>" . $row['Address'] . "</td>";
echo "<td>" . $row['Telephone'] . "</td>";
echo "<td>" . $row['E-mail'] . "</td>";
echo "</tr>";
}
//wipe out result data and close connection
mysql_free_result($result);
mysql_close();
?>
</table>
</body>
</html>
Parse error: syntax error, unexpected T_STRING in C:\xampp\htdocs\address.php on line 2
I mean I have tried single quotes instead of double, I tried combining single and double, I tried adding $connect = at the begging... but still get syntax errors.
Usually I like to figure these things out myself but I feel defeated! and in need of help.
Anyone please
Regards
Ahmed
PEACE