Jump to content

Problems calling a mysql query with php


Fenhopi

Recommended Posts

Hi, I'm working on a friend system for my website.

I'm having some problems with the view pending friend requests page.

The way I have it, is if status is: 0=Friendship requested by another user, 1=already in a friendship.

 

"status" is an INT column in my database.

 

So I did this:


   $status = "SELECT status FROM friends2 WHERE user2='$username'";
   
   $test = $database->query($status);

//If user is 0 (not a friend) then display him and give options to accept or deny request
  if($test == '0'){
   		for($i=0; $i<$num_rows; $i++){
      		$uname  = mysql_result($result,$i,"user1");
 		echo "<a href=\"userinfo.php?user=$uname\"><h3>$uname</h3></a>has requested to become your friend    ";
 		echo "<a href=\"accept.php\">Accept</a>  ";
  		echo "<a href=\"reject.php\">Reject</a><br><br>"; 
   		}
   }
   else{
   echo "No pending requests";
   }


}

 

I'm not getting any errors, but it's obvious that it does not understand my if statement.

Please help me find a solution. Thank you.

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.