Thanks for your quick reply.
I did what you suggested which got rid of the syntax error. Nice explanation
Now it says "mysql_fetch_array(): supplied argument is not a valid MySQL result resource in path/index.php on line 19". I did some research and tried to look for any errors in the remaining code but couldn't find any. Could you please take a quick look at it? Thanks.
Its able to connect to database ok. When I echo the username by just putting in
at the top of the script it works, but I need it to echo other data from the database based on the current username.
Line 19 is the line with WHILE...
//connect to the server
$connect = mysql_connect("localhost","users","password");
//connect to the database
//query the database
$query = mysql_query("SELECT * FROM users WHERE username '".mysql_real_escape_string($_SESSION['username'])."'");
//fetch the results
WHILE($rows = mysql_fetch_array($query)):
$username = $rows['username'];
$email = $rows['coins']
echo "Welcome $username!!! <br> You have $coins coins.";