Jump to content

Get function problem


thefollower

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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';
}

?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.