TheLostGuru Posted April 24, 2007 Share Posted April 24, 2007 Hi, I am brand new to PHP. I have been reading a book called PHP and MySQL and I am trying to run a sample script, but I cannot get it to work. All I am trying to do is pull information from a table in a database and print it in a table. This is my code //All of my connection takes place up here function displayScores($result) { print "<h1>Mathlete Scores</h1>\n"; print "\n<table>\n<tr>\n" . "\n\t<th>Name</th>" . "\n\t<th>Correct</th>" . "\n\t<th>Incorrect</th>" . "\n\t<th>Type</th>" . "\n\t<th>Time</th>" . "\n<\tr>"; while($row = @ mysql_fetch_row($result)) { print "\n<tr>" foreach($row as $data) { print "\n\t<td> {$data} </td>"; } print "\n</tr>"; } print "\n</table>\n"; } $query = "SELECT * FROM TABLE01"; $result = @ mysql_query ($query); displayScores($result); When I test the script in a browser, I get this error: Parse error: parse error in on line 19 Line 19 refers to "foreach($row as $data) {" Thanks for any help! Link to comment https://forums.phpfreaks.com/topic/48405-simple-php-problem/ Share on other sites More sharing options...
fert Posted April 24, 2007 Share Posted April 24, 2007 what does this have to do with OOP? The error is you have a missing ; on the line before Link to comment https://forums.phpfreaks.com/topic/48405-simple-php-problem/#findComment-236700 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.