DEVILofDARKNESS Posted April 6, 2009 Share Posted April 6, 2009 Hi, If I come on the page with this code, I only see one region_name from the table :-s What have I done wrong? <?php session_start(); require_once 'login-check.php'; /*DATABASE SETTINGS */ $nationid = $_SESSION['nationid']; $username = $_SESSION['username']; $query = "SELECT user_id FROM users WHERE user_name = '$username'"; $result = mysql_query($query); list($userID) = mysql_fetch_row($result); if($nationid == $id) { $navigation = "gov.php?nation_id=" . $nationid; }else{ $navigation = "loggedin.php?nation_id=" . $nationid; } $query = "SELECT * FROM regions WHERE region_ruler_id <> '$userID'"; $result = mysql_query($query); while($regions = mysql_fetch_array($result)) { ?> <html> <head> <title> EUROPIA! </title> <meta name="author" content="Kruptein"> <link rel="shortcut icon" href="/images/favicon.ico"> </head> <body> <table border="1" width="100%" height="100%"> <tr> <td colspan = "3" height="15%"> <b><u><center>EUROPIA!</center></u></b> </td> </tr> <tr> <td width="10%"> <iframe src="/navigation/<?php echo $navigation; ?>" frameborder="0" width="100%" scrolling="no" height="100%"></iframe> </td> <td height="80%" width="90%"> <center> Attack A Region!<p> Regions you can conquer:<br> <?php echo $regions['region_name'] . "<br>"; ?> </center> </td> </tr> <tr> <td colspan = "3" height="5%"> <center>Made by Kruptein</center> </td> </tr> </table> </body> </html> <?php } ?> Quote Link to comment Share on other sites More sharing options...
Yesideez Posted April 6, 2009 Share Posted April 6, 2009 For a start I can't see $userID being defined anywhere and where is $id being defined? I see it in an if() statement and not being defined before it's use either. Quote Link to comment Share on other sites More sharing options...
DEVILofDARKNESS Posted April 6, 2009 Author Share Posted April 6, 2009 I have fixed $id, and $userID is defined on line 9, you probably looked over it, but it didn't change anything, it only showed me an other value from the table, but I want to show them all. <?php session_start(); require_once 'login-check.php'; /*DATABASE SETTINGS */ $nationid = $_SESSION['nationid']; $username = $_SESSION['username']; $query = "SELECT user_id FROM users WHERE user_name = '$username'"; $result = mysql_query($query); list($userID) = mysql_fetch_row($result); if($nationid == $userID) { $navigation = "gov.php?nation_id=" . $nationid; }else{ $navigation = "loggedin.php?nation_id=" . $nationid; } $query = "SELECT * FROM regions WHERE region_ruler_id <> '$userID'"; $result = mysql_query($query); while($regions = mysql_fetch_array($result)) { ?> <html> <head> <title> EUROPIA! </title> <meta name="author" content="Kruptein"> <link rel="shortcut icon" href="/images/favicon.ico"> </head> <body> <table border="1" width="100%" height="100%"> <tr> <td colspan = "3" height="15%"> <b><u><center>EUROPIA!</center></u></b> </td> </tr> <tr> <td width="10%"> <iframe src="/navigation/<?php echo $navigation; ?>" frameborder="0" width="100%" scrolling="no" height="100%"></iframe> </td> <td height="80%" width="90%"> <center> Attack A Region!<p> Regions you can conquer:<br> <?php echo $regions['region_name'] . "<br>"; ?> </center> </td> </tr> <tr> <td colspan = "3" height="5%"> <center>Made by Kruptein</center> </td> </tr> </table> </body> </html> <?php } ?> Quote Link to comment Share on other sites More sharing options...
trq Posted April 6, 2009 Share Posted April 6, 2009 Your creating an entire html page for each record. In order for your page to be rendered properly by a browser it needs to adhere to html standards, those standards dictate that you can only have one <html> element in your page. Quote Link to comment Share on other sites More sharing options...
DEVILofDARKNESS Posted April 6, 2009 Author Share Posted April 6, 2009 Alright? HOw Can I solvit? Quote Link to comment Share on other sites More sharing options...
Mark Baker Posted April 6, 2009 Share Posted April 6, 2009 Alright? HOw Can I solvit? ?> <html> <head> <title> EUROPIA! </title> <meta name="author" content="Kruptein"> <link rel="shortcut icon" href="/images/favicon.ico"> </head> <body> <table border="1" width="100%" height="100%"> <?php while($regions = mysql_fetch_array($result)) { ?> <tr> <td colspan = "3" height="15%"> <b><u><center>EUROPIA!</center></u></b> </td> </tr> <tr> <td width="10%"> <iframe src="/navigation/<?php echo $navigation; ?>" frameborder="0" width="100%" scrolling="no" height="100%"></iframe> </td> <td height="80%" width="90%"> <center> Attack A Region!<p> Regions you can conquer:<br> <?php echo $regions['region_name'] . "<br>"; ?> </center> </td> </tr> <tr> <td colspan = "3" height="5%"> <center>Made by Kruptein</center> </td> </tr> <?php } ?> </table> </body> </html> Quote Link to comment Share on other sites More sharing options...
DEVILofDARKNESS Posted April 6, 2009 Author Share Posted April 6, 2009 You did also change the <?php } ?> to above the </table>? I did it thay way and it didn't change a thing? although thanks to try help me. 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.