我有这个似乎不起作用的代码,我想做的是查询以了解用户的级别,然后基于该级别我需要打印不同的内容,目前它打印默认的内容,我收到此错误消息:
mysql_result() 期望参数 1 是资源,在这一行给出布尔值:
$rank = mysql_result($rank1, 0, 'rank');
代码是这样的:
session_start();
if(!$_SESSION['username']){
header("location:login.php"); // Redirect to login.php page
}
else //Continue to current page
header( 'Content-Type: text/html; charset=utf-8' );
$rank1 = mysql_query("SELET access FROM tbl_galleries WHERE column='username" . mysql_real_escape_string($_SESSION['username']) . "'");
$rank = mysql_result($rank1, 0, 'rank');
switch ($rank)
{
case 3:
echo "<div><a href='#'>Order DIAMOND Membership</a></div>";
break;
case 2:
echo "<div><a href='#'>Order PLATINUM Membership</a></div>
<div><a href='#'>Order DIAMOND Membership</a></div>";
break;
case 1:
echo "<div><a href='#'>Order ELITE Membership</a></div>
<div><a href='#'>Order PLATINUM Membership</a></div>
<div><a href='#'>Order DIAMOND Membership</a></div>";
break;
default:
echo "<div><a href='#'>Order PRO Membership</a></div>
<div><a href='#'>Order ELITE Membership</a></div>
<div><a href='#'>Order PLATINUM Membership</a></div>
<div><a href='#'>Order DIAMOND Membership</a></div>";
}