trying to get this code to work

Discussion in 'PHP' started by wilburforce, Feb 19, 2007.

  1. #1
    I know little php and im trying to utilize the code i have found.

    this prints out the members package:
    <? print Q("select gName as result from frm_groups where groupid =".$_SESSION['groupid'],$connector); ?>

    so i thought if i did this it direct accordingly.......im not sure what$connector does.

    <?
    if("select gName as result from frm_groups where groupid =".$_SESSION['groupid'],$connector)=="Admin")
    {
    header('Location:admin.php');
    }
    else
    {
    header('Location:login.php');
    }
    ?>
     
    wilburforce, Feb 19, 2007 IP
  2. Icheb

    Icheb Peon

    Messages:
    1,092
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #2
    $connector is probably the handle for the database connection.
     
    Icheb, Feb 19, 2007 IP
  3. keiths

    keiths Peon

    Messages:
    109
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Depending on what you're trying to do:

    
    <?
    $sql = "select gName as result from frm_groups where groupid =".$_SESSION['groupid'];
    $result = mysql_query($sql);
    $r = mysql_fetch_array($result);
    
    if ($r['gName'] == 'Admin')
    {
    header('Location:admin.php');
    }
    else
    {
    header('Location:login.php');
    }
    ?>
    
    Code (markup):
    Or

    
    <?
    if ($_SESSION['groupid'] == 'ADMIN VALUE ID HERE')
    {
    header('Location:admin.php');
    }
    else
    {
    header('Location:login.php');
    }
    ?>
    
    Code (markup):
     
    keiths, Feb 19, 2007 IP