Jump to content

Archived

This topic is now archived and is closed to further replies.

xyn

Big problem

Recommended Posts

Hey,
this problem i've checked and played with so much
and it's changed nothing, so i need someone who
knows what their doing to have a look at me script.

The problem is I am searching for a members avatar
yet the members name is being outputted because 1.
the name is being displayed and 2. i echo'd it. And when
i put my sql code in a certain place NOTHING will load :/

Confused...
[code=php:0]<?PHP include("session.php");

$chk = @mysql_query("SELECT * FROM pm WHERE id='".$_GET['pm_id']."'");
$num = mysql_num_rows( $chk );
if( !$num )
{
echo "<p><span class=\"heading\">No such message</span><br>
<span class=\"text\">Sorry that message does not exist, please report this problem.</span></p>";
return false;
}

$sql = mysql_query("SELECT fr_usr,subject,message,date,time,pm_id FROM pm WHERE to_usr='{$_SESSION['username']['usr_user']}' AND id='".$_GET['pm_id']."'");
while ($data = mysql_fetch_array( $sql, MYSQL_NUM)) {

$Av_sql = mysql_query("SELECT filename FROM avatar WHERE user='$data[0]'");
while( $Data = mysql_fetch_array( $Av_sql, MYSQL_NUM )){
$Av_num = mysql_num_rows( $Av_sql );
if( !$Av_num ){
$avatar="avatar.PNG";
}else{
$avatar = $Data[0];
}

$usrsql = mysql_query("SELECT usr_rank FROM accounts WHERE usr_user='".$data[0]."'");
while($rank = mysql_fetch_array($usrsql)){
$usr_rank = $rank[0];
if( $usr_rank == "admin" ){
$RankClr = $INFO['ADMIN_NAME_COLOR'];
}elseif( $usr_rank == "mod" ){
$RankClr = $INFO['MOD_NAME_COLOR'];
}else{
$RankClr = $INFO['USER_NAME_COLOR'];
}
}
}

$PmMesg = nl2br( $data[2] );

mysql_query("UPDATE pm SET stats='1' WHERE id='".$_GET['pm_id']."'");
mysql_query("UPDATE pm_sent SET pm_stats='1' WHERE pm_id='$Pmid'");
$SQL = mysql_query("SELECT pm_id FROM pm WHERE id='".$_GET['pm_id']."'");
while( $r = mysql_fetch_array( $SQL, MYSQL_NUM )){
$Pmid = $r[0];
}

echo "<div align=\"center\">
  <center>
  <table border=\"1\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: collapse\" bordercolor=\"#A1A1A1\" width=\"472\">
    <tr>
      <td width=\"470\" colspan=\"2\" height=\"20\" bgcolor=\"#A1A1A1\">
      <p align=\"center\" class=\"boxheading\">".$data[1]."</p>
      </td>
    </tr>
    <tr>
      <td width=\"138\" bgcolor=\"#F1F1F1\" valign=\"top\">
      <p align=\"center\" class=\"text\"><img border=\"0\" height=\"90\" width=\"90\" src=\"./global/images/private/".$avatar."\"><b><br>
      ".$data[0]."</b><br>
      <span class=\"rank\"><font color=\"#".$RankClr."\">".$usr_rank."</font></span></p>
      </td>
      <td width=\"331\" bgcolor=\"#F1F1F1\" valign=\"top\">
      <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: collapse\" bordercolor=\"#111111\" width=\"100%\">
        <tr>
          <td width=\"100%\" valign=\"top\" class=\"text\">".$PmMesg."</td>
        </tr>
        <tr>
          <td width=\"100%\" bgcolor=\"#F1F1F1\" class=\"heading\">".$data[3].", ".$data[4]."</td>
        </tr>
      </table>
      </td>
    </tr>
  </table>
  </center>
</div>
<br>
<div align=\"center\">
  <center>
  <table border=\"1\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: collapse\" bordercolor=\"#A1A1A1\" width=\"470\">
    <tr>
      <td width=\"100%\">
      <table border=\"1\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: collapse\" bordercolor=\"#FFFFFF\" width=\"100%\" height=\"23\">
        <tr class=\"text\">
          <td width=\"25%\" align=\"center\"><a href=\"./index.php?x=delete.post&p=".$data[5]."\">
          <img border=\"0\" src=\"./skin/default/icons/delete.PNG\" width=\"58\" height=\"18\"></a></td>
          <td width=\"25%\" align=\"center\"><a href=\"./index.php?x=reply&p=".$data[5]."\">
          <img border=\"0\" src=\"./skin/default/icons/reply.PNG\" width=\"58\" height=\"18\"></a></td>
          <td width=\"25%\" align=\"center\"><a href=\"./index.php?x=report&p=".$data[5]."\">
          <img border=\"0\" src=\"./skin/default/icons/report.PNG\" width=\"58\" height=\"18\"></a></td>
          <td width=\"25%\" align=\"center\">---</td>
        </tr>
      </table>
      </td>
    </tr>
  </table>
  </center>
</div>";
}

  return true;
?>[/code]

Share this post


Link to post
Share on other sites
sorted it, I discovered twofaults 1 i missed a $ which wasn't errored:/ and two the way i set it out was a mistake.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

×

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.