adam291086 Posted November 23, 2007 Share Posted November 23, 2007 Ok when i execute the code i get the error below. What i dont understand is that i need all of the > to end the html code Can anyone spot the problem, Parse error: parse error, unexpected '>' in /homepages/12/d214897219/htdocs/adam/cycling/authentication/main.php on line 36 <?php session_start(); // is the one accessing this page logged in or not? if (!isset($_SESSION['db_is_logged_in']) || $_SESSION['db_is_logged_in'] !== true) { // not logged in, move to login page header('Location: login.php'); exit; } include 'config.php'; $result = mysql_query("SELECT * FROM tbl_auth_user"); while($row = mysql_fetch_array($result)) { $home = $row['Home page']; $ryedale= $row['Ryedale Rumble']; $adam= $row['Adam']; } if ($home=="yes") { echo ' <p><input type="button" name="edit home page content" value="www.google.com" /></p>'; echo '<br></br>; } elseif ($ryedale=="yes") { echo ' <p><input type="button" name="edit ryedale page content" value="www.google.com" /></p>'; echo '<br></br>; } elseif ($adam=="yes") { echo ' <p><input type="button" name="edit home page content" value="www.google.com" /></p>'; echo '<br></br>; } elseif ($ryedale || $adam || $ryedale =="no") { echo ' <p>you smell</p>'; echo '<br></br>; } include 'closedb.php'; ?> Quote Link to comment Share on other sites More sharing options...
binarymonkey Posted November 23, 2007 Share Posted November 23, 2007 if ($home=="yes") { echo ' <p><input type="button" name="edit home page content" value="www.google.com" /></p>'; echo '<br></br>; should be if ($home=="yes") { echo ' <p><input type="button" name="edit home page content" value="www.google.com" /></p>'; echo '<br></br>'; And theres the same problem on the other similar blocks following it. Quote Link to comment Share on other sites More sharing options...
phpSensei Posted November 23, 2007 Share Posted November 23, 2007 try this <?php session_start(); // is the one accessing this page logged in or not? if (!isset($_SESSION['db_is_logged_in']) || $_SESSION['db_is_logged_in'] !== true) { // not logged in, move to login page header('Location: login.php'); exit; } include 'config.php'; $result = mysql_query("SELECT * FROM tbl_auth_user"); while($row = mysql_fetch_array($result)) { $home = $row['Home page']; $ryedale= $row['Ryedale Rumble']; $adam= $row['Adam']; } if ($home=="yes") { echo ' <p><input type="button" name="edit home page content" value="www.google.com" /></p>'; echo '<br></br>'; } elseif ($ryedale=="yes") { echo ' <p><input type="button" name="edit ryedale page content" value="www.google.com" /></p>'; echo '<br></br>'; } elseif ($adam=="yes") { echo ' <p><input type="button" name="edit home page content" value="www.google.com" /></p>'; echo '<br></br>'; } elseif ($ryedale || $adam || $ryedale =="no") { echo ' <p>you smell</p>'; echo '<br></br>'; } include 'closedb.php'; ?> Quote Link to comment Share on other sites More sharing options...
adam291086 Posted November 23, 2007 Author Share Posted November 23, 2007 ok i have now change all the code to incorporate the changes. Now one button shows. But there should be three buttons in total. It appears the else if statments aren't working <?php session_start(); // is the one accessing this page logged in or not? if (!isset($_SESSION['db_is_logged_in']) || $_SESSION['db_is_logged_in'] !== true) { // not logged in, move to login page header('Location: login.php'); exit; } include 'config.php'; $search = $_SESSION['username']; $result = mysql_query("SELECT * FROM tbl_auth_user WHERE user_id ='$search' "); while($row = mysql_fetch_array($result)) { $home = $row['Home page']; $ryedale= $row['Ryedale Rumble']; $adam= $row['Adam']; } if ($home=="yes") { echo ' <p><input type="button" name="edit home page content" value="www.googhchkjhdsfkjssdfle.com" /></p>'; echo '<br></br>'; } elseif ($ryedale=="yes") { echo ' <p><input type="button" name="edit home page content" value="www.google.com" /></p>'; echo '<br></br>'; } elseif ($adam=="yes") { echo ' <p><input type="button" name="edit home page content" value="www.google.com" /></p>'; echo '<br></br>'; } elseif ($ryedale || $adam || $ryedale =="no") { echo ' <p><input type="button" name="edit home page content" value="www.google.com" /></p>'; echo '<br></br>'; } include 'closedb.php'; ?> Quote Link to comment Share on other sites More sharing options...
phpSensei Posted November 23, 2007 Share Posted November 23, 2007 $result = mysql_query("SELECT * FROM tbl_auth_user WHERE user_id ='$search' ") or die(mysql_error()); Thats the first thing i saw, try that and see if there is a problem with the query... Also change the while statement to while($row = mysql_fetch_array($result)) { $home = $row['Home page']; $ryedale= $row['Ryedale Rumble']; $adam= $row['Adam']; if ($home=="yes") { echo ' <p><input type="button" name="edit home page content" value="www.googhchkjhdsfkjssdfle.com" /></p>'; echo '<br></br>'; } elseif ($ryedale=="yes") { echo ' <p><input type="button" name="edit home page content" value="www.google.com" /></p>'; echo '<br></br>'; } elseif ($adam=="yes") { echo ' <p><input type="button" name="edit home page content" value="www.google.com" /></p>'; echo '<br></br>'; } elseif ($ryedale || $adam || $ryedale =="no") { echo ' <p><input type="button" name="edit home page content" value="www.google.com" /></p>'; echo '<br></br>'; } } Quote Link to comment Share on other sites More sharing options...
adam291086 Posted November 23, 2007 Author Share Posted November 23, 2007 nope, there is nothing worng with the query. This is so strange as it is showing one button. I have manually checked the data base and when logged in as the admin everything is == 'yes'. Therefore all buttons should show. Any ideas? Quote Link to comment Share on other sites More sharing options...
phpSensei Posted November 23, 2007 Share Posted November 23, 2007 nope, there is nothing worng with the query. This is so strange as it is showing one button. I have manually checked the data base and when logged in as the admin everything is == 'yes'. Therefore all buttons should show. Any ideas? Alright try this and tell me if it works.... And if it doesnt, check the coloumn names in your database.... while($row = mysql_fetch_array($result)) { if ($row['Home page'] =="yes") { echo ' <p><input type="button" name="edit home page content" value="www.googhchkjhdsfkjssdfle.com" /></p>'; echo '<br></br>'; } if ($row['Ryedale Rumble'] == "yes") { echo ' <p><input type="button" name="edit home page content" value="www.google.com" /></p>'; echo '<br></br>'; } if ($row['Adam'] == "yes") { echo ' <p><input type="button" name="edit home page content" value="www.google.com" /></p>'; echo '<br></br>'; } if ($ryedale || $adam || $ryedale =="no") { echo ' <p><input type="button" name="edit home page content" value="www.google.com" /></p>'; echo '<br></br>'; } } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.