Hi, sup? 🙂
I got a little problem, maybe 1 of you can help me out....
I have a login script, that after a user which has lvl 1 has logged in, he goes to a new page, and with a query his stats are loaded into the page. (this is workin).. the code i use is :
$sql = "SELECT * FROM cijfers WHERE naam = '$_SESSION[sUser]' ORDER by cijfer ASC ";
$query = mysql_query($sql) or die(mysql_error());
while ($obj = mysql_fetch_object($query)) { //echo data// }
now i have a user with lvl 2, he goes to another page on which he can see all the lvl 1 users. what I wanna do is this:
When a lvl2 users clicks on a number of 1 of the lvl1 users, a new page will open with the data in it from this specific user.
this is what I got, but it doesn't work..
<?php
include ('connect.php');
$sql = "SELECT id, nummer, naam, opleiding FROM members WHERE level = '1' ORDER by naam ASC "; // laat alleen studenten zien
$query = mysql_query($sql) or die(mysql_error());
while ($obj = mysql_fetch_object($query)) {
$_SESSION['sNummer'] = $obj->nummer;
echo'
<table width="98%" border="1" bordercolor="black" bgcolor="gray">
<tr> <td align="right" width="19%">
<a href="studenttabel2.php?'.$obj->nummer.' ">'.$obj->nummer.'</a>
</td>
<td align="right" width="19%">'.$obj->naam.'</td>
<td align="right" width="19%">'.$obj->opleiding.'</td>
</tr>
</table>';
}
}
i know it doesn't work bcuz of the while loop, it will always display the data of the last query data in the loop...
how can I change it, so the number which is pressed is used to get the data?
thnx