chrisdixon Posted June 6, 2010 Share Posted June 6, 2010 hey forum, i am getting this error displaying in my browser Parse error: parse error in C:\Wamp Server\wamp\www\modern_cms\index.php on line 28 here is my index.php file <?php include '_class/cms_class.php'; $obj = new modernCMS(); //Setup Our Connection Vars $obj->host = 'localhost'; $obj->username = ''; $obj->password = ''; $obj->db = 'modernCMS'; //connect to our DB $obj->connect(); ?> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> <title>My Modern CMS</title> <link href="style.css" rel="stylesheet" type="text/css"> </head> <body> <div id="page_wrap"> <?php if(isset($GET['id']); else: <?php echo $obj->get_content() ?> endif; ?> </div> </body> </html> and my cms_class.php <?php class modernCMS { var $host; var $username; var $password; var $db; function connect() { $con = mysql_connect($this->host, $this->username, $this->password) or die(mysql_error()); mysql_select_db($this->db, $con) or die(mysql_error()); } function get_content($id = ''){ $sql = "SELECT * FROM cms_content ORDER BY id DESC"; $res = mysql_query($sql) or die(mysql_error()); while($row = mysql_fetch_assoc($res)){ echo '<h1><a href="index.php?id=' . $row['id'] . '">' . $row['title'] . '</a></h1>'; echo '<p>' . $row['body'] . '</p>'; } } }//Ends our class ?> probably a very simple fix to you guys but i am only just beginning PHP. please help Thanks Link to comment https://forums.phpfreaks.com/topic/204046-parse-error-from-else-statement/ Share on other sites More sharing options...
Alex Posted June 6, 2010 Share Posted June 6, 2010 <?php if(isset($GET['id']): // ... else: echo $obj->get_content(); endif; ?> Link to comment https://forums.phpfreaks.com/topic/204046-parse-error-from-else-statement/#findComment-1068760 Share on other sites More sharing options...
chrisdixon Posted June 6, 2010 Author Share Posted June 6, 2010 thanks for reply Alex but i am still getting the error Parse error: parse error in C:\Wamp Server\wamp\www\modern_cms\index.php on line 28 (if(isset($GET['id']): is on line 28) <div id="page_wrap"> <?php if(isset($GET['id']): // ... else: echo $obj->get_content(); endif; ?> </div> Link to comment https://forums.phpfreaks.com/topic/204046-parse-error-from-else-statement/#findComment-1068762 Share on other sites More sharing options...
Muffins Posted June 6, 2010 Share Posted June 6, 2010 You need to close your if statement. You are missing a ) Link to comment https://forums.phpfreaks.com/topic/204046-parse-error-from-else-statement/#findComment-1068763 Share on other sites More sharing options...
chrisdixon Posted June 6, 2010 Author Share Posted June 6, 2010 haha rookie error thanks Link to comment https://forums.phpfreaks.com/topic/204046-parse-error-from-else-statement/#findComment-1068766 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.