View Single Post
  #3 (permalink)  
Old 04-25-2008, 02:38 PM
itwasntme's Avatar
itwasntme itwasntme is offline
Senior Member
 
Join Date: Sep 2007
Posts: 120
Default

The code is going to have to specify which user to select; otherwise, you're going to get unpredictable results.

Proxomos code modified to do so would look like:
Code:
$result = mysql_query("SELECT admin FROM users WHERE id=$user_id");
list($admin)=mysql_fetch_row($result);

switch ($admin){
case 0:
   header("Location: members.php");
   break;

case 1:
  header("Location: admin.php");
  break;
}
That's if you have a unique (primary key) field in your DB called "id" and have already declared the variable $user_id according to the login procedure to correspond to the current user. You'll need to change that part to match your field name.

Last edited by itwasntme; 04-25-2008 at 02:41 PM.
Reply With Quote