/    Sign up×
Community /Pin to ProfileBookmark

Add Page enQuiry

how would i go about making my script to see if the users rank is above say rank 10 without them going through the process of relogining in every time to go to the same page but if they are logged in and below that rank they get you cant any ideas on how i g about it i pretty much got it like this

[code=php]
session_start()l
include(“dbconnect.php”);
error_reporting(E_ALL);
if($_session[‘user’])
{
$cQuery=”select * from members where username='”.$username.”‘”;
echo $cQuery;
$rs=mysqli_query($con,$cQuery)
if(!$rs)
{
echo “Error:”.mysqli_error($con);
}
else
{
if($data[‘rank’]>=19)
{
$user=TRUE;
echo “Welcome to recruitment page”;
}
else
{
echo “You cant”;
}
}
}
else
{
include(“login.php”);
}
[/code]

to post a comment
PHP

6 Comments(s)

Copy linkTweet thisAlerts:
@DJsACSep 04.2006 — change $data['rank'] to $rs['rank'] and it will probably work...

remove the 1 at the very top to get rid of the parse error.

under $user=TRUE;

put:

$_SESSION['recruituser'] = 'loggedin';

that will put that string in the session, and you can then check if that variable is set, if not have them log in, if it is set, just load the page ?
Copy linkTweet thisAlerts:
@william232authorSep 04.2006 — you have just given me

Fatal Error:cannot use object of type mysqli_result as array in on line 12

on that line i have

if($rs['rank']>=19)
Copy linkTweet thisAlerts:
@The_Little_GuySep 04.2006 — try to echo out $rs['rank'] somewhere

maybe like this:

[B]cQuery="select * from members where username='".$username."'";

echo $cQuery;

$rs=mysqli_query($con,$cQuery)

echo $rs['rank'];[/B]


This would be to see if it is even getting the correct info, or if it is even returning a number.
Copy linkTweet thisAlerts:
@DJsACSep 04.2006 — in that case, I don't understand what you're trying to do...
Copy linkTweet thisAlerts:
@william232authorSep 04.2006 — nothing i just get the query thats all nothing else
Copy linkTweet thisAlerts:
@The_Little_GuySep 04.2006 — Try it like this.

[B]cQuery="select * from members where username='".$username."'";

echo $cQuery;

$rs=mysqli_query($con,$cQuery);

$data=mysqli_fetch_array($rs);

echo $data['rank'];[/B]
×

Success!

Help @william232 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...