dave_55 Posted March 30, 2008 Share Posted March 30, 2008 hi im having a problem with my work, this is my code and it is not displaying my table information. im running this of wamp server if that makes any difference. I have check if t at least connects and it does, it just doesnt display my table tho????? Can anybody help??? 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"); echo "Connected to MySQL<br>"; //select a database to work with $selected = mysql_select_db("lincolnrugby",$dbhandle) or die("Could not select lincoln rugby"); $result = mysql_query("SELECT * FROM fixtures"); //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); ?> Output: Connected to MySQL Date:Home or Away Game:Home Team:Away Team: Date:Home or Away Game:Home Team:Away Team: Date:Home or Away Game:Home Team:Away Team: Date:Home or Away Game:Home Team:Away Team: Date:Home or Away Game:Home Team:Away Team: Date:Home or Away Game:Home Team:Away Team: Date:Home or Away Game:Home Team:Away Team: Date:Home or Away Game:Home Team:Away Team: Date:Home or Away Game:Home Team:Away Team: Date:Home or Away Game:Home Team:Away Team: Date:Home or Away Game:Home Team:Away Team: Date:Home or Away Game:Home Team:Away Team: Date:Home or Away Game:Home Team:Away Team: Date:Home or Away Game:Home Team:Away Team: Date:Home or Away Game:Home Team:Away Team: Date:Home or Away Game:Home Team:Away Team: Date:Home or Away Game:Home Team:Away Team: Date:Home or Away Game:Home Team:Away Team: Date:Home or Away Game:Home Team:Away Team: Date:Home or Away Game:Home Team:Away Team: Date:Home or Away Game:Home Team:Away Team: Date:Home or Away Game:Home Team:Away Team: Can anybody help me please ive tried so many things now? Link to comment https://forums.phpfreaks.com/topic/98689-unable-to-display-my-tables/ Share on other sites More sharing options...
BlueSkyIS Posted March 30, 2008 Share Posted March 30, 2008 use square brackets, not curly: $row['date'] Link to comment https://forums.phpfreaks.com/topic/98689-unable-to-display-my-tables/#findComment-505062 Share on other sites More sharing options...
metrostars Posted March 30, 2008 Share Posted March 30, 2008 Should the curly braces not be square? Link to comment https://forums.phpfreaks.com/topic/98689-unable-to-display-my-tables/#findComment-505063 Share on other sites More sharing options...
dave_55 Posted March 30, 2008 Author Share Posted March 30, 2008 Hey guys ive tried it both ways now and they both display the data in the same way as before am i doing something totally wrong, im new to PHP??? Link to comment https://forums.phpfreaks.com/topic/98689-unable-to-display-my-tables/#findComment-505073 Share on other sites More sharing options...
BlueSkyIS Posted March 30, 2008 Share Posted March 30, 2008 do these columns exist in your table and are they populated with data? date homeawaygame hometeam awayteam Link to comment https://forums.phpfreaks.com/topic/98689-unable-to-display-my-tables/#findComment-505075 Share on other sites More sharing options...
dave_55 Posted March 30, 2008 Author Share Posted March 30, 2008 Hi yeah they have data in them, ive just been back and checked. The only difference is that they are Date HomeAwayGame HomeTeam AwayTeam Does the capitals matter then? Link to comment https://forums.phpfreaks.com/topic/98689-unable-to-display-my-tables/#findComment-505078 Share on other sites More sharing options...
ds111 Posted March 30, 2008 Share Posted March 30, 2008 yes, capitals matter...i think Link to comment https://forums.phpfreaks.com/topic/98689-unable-to-display-my-tables/#findComment-505079 Share on other sites More sharing options...
andrew6607 Posted March 30, 2008 Share Posted March 30, 2008 Yes they do matter. Link to comment https://forums.phpfreaks.com/topic/98689-unable-to-display-my-tables/#findComment-505080 Share on other sites More sharing options...
dave_55 Posted March 30, 2008 Author Share Posted March 30, 2008 Thats awesome got them working now thanks for your help. One more question tho, how do i get them displayed more neatly and not like this. Can i not have all the information displayed under the headings date, homeawaygame, etc????? Connected to MySQL Date: 2007-09-08 HomeAwayGame: Away HomeTeam: Nottingham Moderns AwayTeam: Lincoln Date: 2007-09-15 HomeAwayGame: Away HomeTeam: Glossop AwayTeam: Lincoln Date: 2007-09-22 HomeAwayGame: Home HomeTeam: Lincoln AwayTeam: IIkelston Date: 2007-09-29 HomeAwayGame: Away HomeTeam: Mansfield AwayTeam: Lincoln Date: 2007-10-06 HomeAwayGame: Home HomeTeam: Lincoln AwayTeam: Oakham Date: 2007-10-20 HomeAwayGame: Away HomeTeam: Spalding AwayTeam: Lincoln Link to comment https://forums.phpfreaks.com/topic/98689-unable-to-display-my-tables/#findComment-505087 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.