Jump to content

mysql_query help


tebrown

Recommended Posts

Hey Guys,

 

Im having problems with my code. What im trying to do is run a mysql query and show the results, but if the query returns no data, echo out "No incoming requests!"

 

Here is my code:

 

	<?

	$check = "SELECT * FROM requests WHERE club='" . $_SESSION['club'] . "' AND team='" . $_SESSION['team'] . "' AND accepted='0'";
	$result=mysql_query($check);

	if (mysql_num_rows($result) == 0) {

		while ($getinfo = mysql_fetch_array($result)) {
            $time = $getinfo["time"];
		    $who = $getinfo["player_name"];
		    $whofor = $getinfo["toplayfor"];
		    $from = $getinfo["team"];
		    $idp = $getinfo["player_id"];

	echo "<a href='profile.php?id=".$idp."&team=".$from."'>".$who." </a><div style='float:right;'>(".$from.")</div><br />";
	echo "<div style='margin-top: 2px;'></div>";
	echo date('l, F jS, g:ia',$time);
	echo "<br /><div style='margin-top: 2px;'></div><a href='accept.php?playerid=".$idp."&toplayfor=".$whofor."'>Accept</a> | Decline";
	echo "<div id='newsline'></div>";
}
}

else {
echo 'No incoming requests'; }

	?>

 

Could someone help me out here?

 

Thanks Heaps!

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.