Problem | i dont know whats wrong

Discussion in 'PHP' started by Shiftil, Mar 10, 2009.

  1. #1
    
    <body>
    <form name="login" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
    <P>Username: <input name="username" type="text" /></P>
    <p>password:<input name="password" type="password"/></p>
    <input type="submit" name="check_if_press" value="came in" />
    </form>
    <?php
                                      ///====MYSQL connect===///
    $connect = mysql_connect("localhost","root","");
    if (!$connect)
      {
      die('Could not connect: ' . mysql_error());
      }
    mysql_select_db("shift",$connect);
    $result = mysql_query("SELECT * FROM users");
    //$row = mysql_fetch_array($result);
    
    
    
    while($row = mysql_fetch_array($result))
      {
    
    if (isset($_POST['username'] == $row['username'] && $_POST['password'] == $row['password']))
        {
        echo "First name: ".$_POST['username']."<br />";
        echo "Last name: ".$_POST['password']."<br />";
        }
      }
    
    
    ?>
    
    
    Code (markup):
    now i have the error in line
    if (isset($_POST['username'] == $row['username'] && $_POST['password'] == $row['password']))
    Code (markup):
    whats wrong????

    i new in PHP So....

    i just want to do a login users from the mysql
     
    Shiftil, Mar 10, 2009 IP
  2. bartolay13

    bartolay13 Active Member

    Messages:
    735
    Likes Received:
    14
    Best Answers:
    1
    Trophy Points:
    98
    #2
    is there any error messages coming out?
     
    bartolay13, Mar 10, 2009 IP
  3. Shiftil

    Shiftil Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    is this error
     
    Shiftil, Mar 10, 2009 IP
  4. exodus

    exodus Well-Known Member

    Messages:
    1,900
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    165
    #4
    isset does 1 variable and not meant to wrap around others your evaling.

    if ($_POST['username'] == $row['username'] && $_POST['password'] == $row['password'])
    PHP:
     
    exodus, Mar 10, 2009 IP
  5. Shiftil

    Shiftil Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    ok
    10X :)
     
    Shiftil, Mar 10, 2009 IP
  6. exodus

    exodus Well-Known Member

    Messages:
    1,900
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    165
    #6
    Well, you can do more then one var with isset but it has to be like isset($var1, $var2, $var3) and can't have any eval statements in it.
     
    exodus, Mar 10, 2009 IP