Danny620 Posted April 18, 2010 Share Posted April 18, 2010 when i run this script all i keep getting is Parse error: syntax error, unexpected ';', expecting T_FUNCTION in C:\xampp\htdocs\cms\nav.php on line 35 <?php class Northplanet { function Nav_Bar(){ //Select Links From DB require 'mysqli.php'; $query = "SELECT link, link_title FROM links"; $result = $mysqli->query($query) or die(mysqli_error($mysqli)); //Links have been found if($result){ echo "<ul>\n"; while ($row = $result->fetch_object()) { $link = $row->link; $title = $row->link_title; echo "<li><a href=\"$link\">$title</a></li>\n"; } echo "</ul>\n"; } } ?> Link to comment https://forums.phpfreaks.com/topic/198946-this-error-is-driving-me-crazy-please-somebody-help-me-out/ Share on other sites More sharing options...
TeddyKiller Posted April 18, 2010 Share Posted April 18, 2010 Try tidying the code up. <?php class Northplanet { function Nav_Bar(){ //Select Links From DB require 'mysqli.php'; $query = "SELECT link, link_title FROM links"; $result = $mysqli->query($query) or die(mysqli_error($mysqli)); //Links have been found if($result){ echo "<ul>\n"; while ($row = $result->fetch_object()) { $link = $row->link; $title = $row->link_title; echo "<li><a href=\"$link\">$title</a></li>\n"; } echo "</ul>\n"; } } ?> You appear not to be closing the class. There is a missing } at the end. Link to comment https://forums.phpfreaks.com/topic/198946-this-error-is-driving-me-crazy-please-somebody-help-me-out/#findComment-1044295 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.