thefollower Posted November 29, 2007 Share Posted November 29, 2007 I have a GET function which doesn't echo anything when the link is clicked... can't see where i have gone wrong.. perhaps you guys can spot it : <font style="font-size:13px" color="#FFFFFF" face="Arial"><b><u><a href="friendenemylist.php?friends">Friends List</a></u></b></font></div> This is the get url when i click it: /friendenemylist.php?friends If (isset($_GET['friends'])){ $Get = mysql_query("SELECT * FROM userregistration WHERE UserID='{$_SESSION['Current_User']}'") or die(mysql_error()); $Row = mysql_fetch_assoc($Get); $BeenDonator = $Row['HasBeenDonator']; If($BeenDonator == 1){ $GetList = mysql_query("SELECT * FROM friendslist WHERE UserID='{$_SESSION['Current_User']}'") or die(mysql_error()); If (mysql_num_rows($GetList) > 0){ ?> <div id="bv_" style="position:absolute;left:50px;top:350px;width:150px;height:22px;z-index:1" align="center"> <table width="800" border="1" cellpadding="0" cellspacing="0"> <tr> <td width="200"><font style="font-size:14px" color="#FFFFFF" face="Arial"><center><b><u>UserName:</center></b></u></font></td> <td width="100"><font style="font-size:14px" color="#FFFFFF" face="Arial"><center><b><u>UserID:</center></b></u></font></td> <td width="200"><font style="font-size:14px" color="#FFFFFF" face="Arial"><center><b><u>Infomation:</center></b></u></font></td> <td width="80"><font style="font-size:14px" color="#FFFFFF" face="Arial"><center><b><u>Online:</center></b></u></font></td> <td width="80"><font style="font-size:14px" color="#FFFFFF" face="Arial"><center><b><u>Has you?:</center></b></u></font></td> </tr> <? while($ListRow = mysql_fetch_array($GetList)) { $FriendID = $ListRow['FriendID']; $Description = $ListRow['Description']; $GetUsername = mysql_query("SELECT * FROM userregistration WHERE UserID='$FriendID'") or die(mysql_error); $Usernamerow = mysql_fetch_assoc($GetUsername); $Username = $Usernamerow['Username']; $Online = $Usernamerow['Online']; If($Online == 1){ $YesNo = 'Online'; }Else{ $YesNo = 'Offline'; } $GotYou = mysql_query("SELECT * FROM friendslist WHERE UserID='$FriendID' AND FriendID='{$_SESSION['Current_User']}'") or die(mysql_error()); if(mysql_num_rows == 1){ $HasYou = 'Yes'; }Else{ $HasYou = 'No'; } ?> <tr> <td width="200"><center><font style="font-size:14px" color="#32CD32" face="Arial"><?=$Username?></center></font></td> <td width="100"><center><font style="font-size:14px" color="#32CD32" face="Arial"><?=$FriendID?></center></font></td> <td width="200"><center><font style="font-size:14px" color="#32CD32" face="Arial"><?=$Description?></center></font></td> <td width="80"><center><font style="font-size:14px" color="#32CD32" face="Arial"><?=$YesNo?></center></font></td> <td width="80"><center><font style="font-size:14px" color="#32CD32" face="Arial"><?=$HasYou?></center></font></td> </tr> <? } }Else{ ?> <div id="bv_" style="position:absolute;left:280px;top:400px;width:300px;height:24px;z-index:11" align="center"> <font style="font-size:15px" color="#FFFFFF" face="Arial"><b><u>You have no one on your friends list!</u></b></font></div> <? } } } I get complete blankness :S Quote Link to comment https://forums.phpfreaks.com/topic/79470-get-function-problem/ Share on other sites More sharing options...
pocobueno1388 Posted November 29, 2007 Share Posted November 29, 2007 You have to actually set "friends" in the URL to something. Your URL looks like this friendenemylist.php?friends It SHOULD look like this friendenemylist.php?friends=view Where "view" is, you can put anything...whatever is appropriate. Quote Link to comment https://forums.phpfreaks.com/topic/79470-get-function-problem/#findComment-402400 Share on other sites More sharing options...
thefollower Posted November 29, 2007 Author Share Posted November 29, 2007 But isn't that only if i want to carry infomation with it ? Cos i have this: <div id="bv_" style="position:absolute;left:120px;top:265px;width:150px;height:16px;z-index:12" align="center"> <font style="font-size:13px" color="#FFFFFF" face="Arial"><b><u><a href="friendenemylist.php?friends">Friends List</a></u></b></font></div> <div id="bv_" style="position:absolute;left:600px;top:265px;width:150px;height:16px;z-index:12" align="center"> <font style="font-size:13px" color="#FFFFFF" face="Arial"><b><u><a href="friendenemylist.php?enemys">Enemy List</a></u></b></font></div> if you try a simple if statement with an echo with them it does echo correctly.. Like If(isset($_GET['friends'])){ echo ' 2'; } ElseIf(isset($_GET['enemys'])){ echo ' 3'; } it works on my screen. Quote Link to comment https://forums.phpfreaks.com/topic/79470-get-function-problem/#findComment-402405 Share on other sites More sharing options...
pocobueno1388 Posted November 29, 2007 Share Posted November 29, 2007 Well...I suppose you can do that then. Try this code and tell me what it does <?php If (isset($_GET['friends'])) { $Get = mysql_query("SELECT * FROM userregistration WHERE UserID='{$_SESSION['Current_User']}'") or die(mysql_error()); $Row = mysql_fetch_assoc($Get); $BeenDonator = $Row['HasBeenDonator']; If ($BeenDonator == 1) { $GetList = mysql_query("SELECT * FROM friendslist WHERE UserID='{$_SESSION['Current_User']}'") or die(mysql_error()); If (mysql_num_rows($GetList) > 0) { ?> <div id="bv_" style="position:absolute;left:50px;top:350px;width:150px;height:22px;z-index:1" align="center"> <table width="800" border="1" cellpadding="0" cellspacing="0"> <tr> <td width="200"><font style="font-size:14px" color="#FFFFFF" face="Arial"><center><b><u>UserName: </center></b></u></font></td> <td width="100"><font style="font-size:14px" color="#FFFFFF" face="Arial"><center><b><u>UserID: </center></b></u></font></td> <td width="200"><font style="font-size:14px" color="#FFFFFF" face="Arial"><center><b><u>Infomation: </center></b></u></font></td> <td width="80"><font style="font-size:14px" color="#FFFFFF" face="Arial"><center><b><u>Online: </center></b></u></font></td> <td width="80"><font style="font-size:14px" color="#FFFFFF" face="Arial"><center><b><u>Has you?: </center></b></u></font></td> </tr> <?php while ($ListRow = mysql_fetch_array($GetList)) { $FriendID = $ListRow['FriendID']; $Description = $ListRow['Description']; $GetUsername = mysql_query("SELECT * FROM userregistration WHERE UserID='$FriendID'") or die(mysql_error); $Usernamerow = mysql_fetch_assoc($GetUsername); $Username = $Usernamerow['Username']; $Online = $Usernamerow['Online']; If ($Online == 1) { $YesNo = 'Online'; } Else{ $YesNo = 'Offline'; } $GotYou = mysql_query("SELECT * FROM friendslist WHERE UserID='$FriendID' AND FriendID='{$_SESSION['Current_User']}'") or die(mysql_error()); if (mysql_num_rows == 1) { $HasYou = 'Yes'; } Else{ $HasYou = 'No'; } ?> <tr> <td width="200"><center><font style="font-size:14px" color="#32CD32" face="Arial"><?=$Username?> </center></font></td> <td width="100"><center><font style="font-size:14px" color="#32CD32" face="Arial"><?=$FriendID?> </center></font></td> <td width="200"><center><font style="font-size:14px" color="#32CD32" face="Arial"><?=$Description?> </center></font></td> <td width="80"><center><font style="font-size:14px" color="#32CD32" face="Arial"><?=$YesNo?></center> </font></td> <td width="80"><center><font style="font-size:14px" color="#32CD32" face="Arial"><?=$HasYou?> </center></font></td> </tr> <?php } } Else { ?> <div id="bv_" style="position:absolute;left:280px;top:400px;width:300px;height:24px;z-index:11" align="center"> <font style="font-size:15px" color="#FFFFFF" face="Arial"><b><u>You have no one on your friends list! </u></b></font></div> <?php } } else { echo 'The variable $beenDonator DOES NOT equal 1'; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/79470-get-function-problem/#findComment-402406 Share on other sites More sharing options...
thefollower Posted November 29, 2007 Author Share Posted November 29, 2007 Argh its the BeenDonator wasn't 1! Damn it ! i was echo'in it and it was coming out blank so i assumed the code wasn't reaching that part of the script yet! Thanks for that! I think i need a lie down and have a break after that silly mistake! Quote Link to comment https://forums.phpfreaks.com/topic/79470-get-function-problem/#findComment-402412 Share on other sites More sharing options...
pocobueno1388 Posted November 29, 2007 Share Posted November 29, 2007 Don't forget to click solved Unless of course you need help figuring out why it doesn't have a value. Quote Link to comment https://forums.phpfreaks.com/topic/79470-get-function-problem/#findComment-402416 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.