sup yo
I'm trying to get data from database based on index.php?url=hk&staffapps&read={id}. {id} is based on data that is from database. hoping this makes sense.
So my code:
When i remove the if(isset($_GET['read'])) part page works well but not if it exists. Any help appreciated.
I'm trying to get data from database based on index.php?url=hk&staffapps&read={id}. {id} is based on data that is from database. hoping this makes sense.
So my code:
PHP:
<table align = "center">
<tr>
<th>ID</th>
<th >Username</th>
<th>Age</th>
<th >Skype</th>
<th >Read</th>
</tr>
<?php
$q = mysql_query("SELECT * FROM staffapps");
while ($m = mysql_fetch_array($q)) {
?>
<tr align = "center">
<td ><?php echo $m['id']; ?></td>
<td ><?php echo $m['un']; ?></td>
<td ><?php echo $m['age']; ?></td>
<td ><?php echo $m['skype']; ?></td>
<td><a href="http:/mydomain.com/index.php?url=hk<?php echo $m['id'];?>">Read </a></td>
</tr>
</table>
<?php }
if(isset($_GET['read'])){
$g = $_GET['read'];
$sql = mysql_query("SELECT * FROM staffapps WHERE id = '$g'");
while($r = mysql_fetch_array($sql){
echo'
<table align="cetner">
<tr>
<th> ID </td>
<th>Username</td>
<th>Real Name</th>
<th>Age</th>
<th>Skype</th>
<th>Position</th>
<th>Online Hours</th>
<th>Experiences</th>
<th>Why</th>
<th>Difference</th>
</tr>
<tr>
<td> '. $r['id'] .'</td>
<td> '. $r['un'] .'</td>
<td> '.$r['realname'] .'</td>
<td>'. $r['age'] .'</td>
<td> '. $r['skype'] .'</td>
<td> '/*.if($r['pos'] == "1") { echo "Events Staff"; } else{ echo "Moderator";}. '*/'</td>
<td> '.$r['hours'].'</td>
<td>'.$r['exp'].'</td>
<td>'.$r['why'] .'</td>
<td>'. $r['diff'].'</td>
</tr></table>';
}
} else {
// nothing to do....
}?>