Cannot display my table
Posted by: dave_harding55 (---.pool1.Mansfield-NOT6900-BAS0001.orangehomedsl.co.uk)
Date: March 30, 2008 09:55PM

I am having issues with displaying information from my table. I can connect fine but i keep getting this error Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in C:\wamp\www\Lincoln Rugby\untitled1.php on line 22

Does anybody know why???

This is my code:

<?php
$database = "localhost"; //login to the server
$username = "dave"; //username login
$password = "*******"; //password login

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

//select a database to work with
$selected = mysql_select_db("lincolnrugby",$dbhandle)
or die("Could not select lincoln rugby"winking smiley;

$result = mysql_query("SELECT * FROM fixtures"winking smiley; //execute the SQL query and return records




while($row = mysql_fetch_array($result)){
echo "Date:".$row{'date'}."Home or Away Game:".$row{'homeawaygame'}."Home Team:".$row{'hometeam'}."Away Team:".$row{'awayteam'}."<br>"; //display the result
}

//close the connection
mysql_close($dbhandle);

?>

Options: ReplyQuote
Re: Cannot display my table
Posted by: yfastud (Moderator)
Date: March 31, 2008 03:26AM

echo "Date:".$row{'date'}."Home or Away Game:".$row{'homeawaygame'}."Home Team:".$row{'hometeam'}."Away Team:".$row{'awayteam'}."<br>"; //display the result
Replace {} w/ [] and try again

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides

Options: ReplyQuote


Sorry, only registered users may post in this forum.