Jump to content

[SOLVED] need some simple php/mysql help


mybluehair

Recommended Posts

ok, im creating a chatroom using only php and mysql. ive gotten pretty far, and now i am running into a problem. i have gotten to the point were there is a member system. they have to be loged in to chat. well when they register it creates a new mysql row in a table called users. the feilds in this table are (in order) :

id, Username, Password, Name, Email, Date, IP, Actkey, Activated, rank

 

as you see at the end "rank". there are only 2 different things that can be. 1 or 2. 1 means your just a regular member. 2 means your a admin. now my problem is i need a php code that will grab that info if your a 1 or a 2. and then i need to make a if statement like maybe:

if($rank == 2){

echo "<center><a href=\"ap.php\">Admin panel</a></center><br>";

} else {

    }

so i need a way to do this and i dont know how. can someone please help me?

Link to comment
https://forums.phpfreaks.com/topic/77982-solved-need-some-simple-phpmysql-help/
Share on other sites

I don't quite understand your problem, but if I am correct..

<?php
$connect = mysql_connect([i]host[/i], [i]user[/i], [i]password[/i]);
mysql_select_db([i]database[/i], $connect);
$query = mysql_query("SELECT `rank` FROM `users` WHERE `id` = '" . $current_id . "'", $connect);
if (mysql_result($query, 0) == 2) 
   echo '<p align="center"><a href="admin.php">Administration</a></p>';
?>

 

Else, please explain a bit more in detail what you want to accomplish.

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.