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
https://forums.phpfreaks.com/topic/262715-mysql_query-help/
Share on other sites

Archived

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

×
×
  • 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.