<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
isset does 1 variable and not meant to wrap around others your evaling. if ($_POST['username'] == $row['username'] && $_POST['password'] == $row['password']) PHP:
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.