Author Topic: How to check if the person is an admin?  (Read 604 times)

0 Members and 1 Guest are viewing this topic.

Offline nakashTopic starter

  • Irregular
  • Posts: 3
    • View Profile
How to check if the person is an admin?
« on: June 13, 2010, 05:31:59 PM »
Hey there, I'm new to MYSQL and PHP and I'd like to ask a few questions;
I have a database with 3 users and I want to check if that person is an administrator, I've already created the field 'Admin' in the database, but I don't know how to check it in the file.
I'm using a login system and it saves the session of his ID and the name.
Code: [Select]
$member = mysql_fetch_assoc($result);
$_SESSION['SESS_MEMBER_ID'] = $member['id'];
$_SESSION['SESS_FIRST_NAME'] = $member['Name'];
Is there a way to check if that specific person is an admin?
Thanks in advance.
« Last Edit: June 13, 2010, 05:32:45 PM by nakash »

Offline nakashTopic starter

  • Irregular
  • Posts: 3
    • View Profile
Re: How to check if the person is an admin?
« Reply #1 on: June 13, 2010, 06:25:51 PM »
Hey there, I'm new to MYSQL and PHP and I'd like to ask a few questions;
I have a database with 3 users and I want to check if that person is an administrator, I've already created the field 'Admin' in the database, but I don't know how to check it in the file.
I'm using a login system and it saves the session of his ID and the name.
Code: [Select]
$member = mysql_fetch_assoc($result);
$_SESSION['SESS_MEMBER_ID'] = $member['id'];
$_SESSION['SESS_FIRST_NAME'] = $member['Name'];
Is there a way to check if that specific person is an admin?
Thanks in advance.

Sorry for doubleposting, but I couldn't edit this message.

My second question is how do I do change a field of someone using his ID? ('id')
I know it's something with UPDATE ;p
« Last Edit: June 13, 2010, 06:26:57 PM by nakash »

Offline fenway

  • MySQL Si-Fu / PHP Resident Alien
  • Global Moderator
  • 'Mind Boggling!'
  • *
  • Posts: 15,443
  • Gender: Male
    • View Profile
Re: How to check if the person is an admin?
« Reply #2 on: June 13, 2010, 07:32:48 PM »
Sounds like you're asking how to use a database.
:anim_rules: Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

Offline James25

  • Irregular
  • Posts: 18
    • View Profile
Re: How to check if the person is an admin?
« Reply #3 on: June 14, 2010, 02:32:36 AM »
but what is the problem?

Offline nakashTopic starter

  • Irregular
  • Posts: 3
    • View Profile
Re: How to check if the person is an admin?
« Reply #4 on: June 14, 2010, 03:41:18 AM »
Sounds like you're asking how to use a database.
Oh.. nonono lol.
I forgot to mention that I need those to be scripted in PHP.

Offline fenway

  • MySQL Si-Fu / PHP Resident Alien
  • Global Moderator
  • 'Mind Boggling!'
  • *
  • Posts: 15,443
  • Gender: Male
    • View Profile
Re: How to check if the person is an admin?
« Reply #5 on: June 15, 2010, 08:52:09 AM »
Sounds like you're asking how to use a database.
Oh.. nonono lol.
I forgot to mention that I need those to be scripted in PHP.
Right -- so you're asking how to query a database with PHP.
:anim_rules: Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.