简体   繁体   中英

select specific row php and mysql

I know its sounds like repeated but really I didn't find an answer for the problem am having.

am making a form to get specific details which is password this is the form

<form method="post" name="lostpass" action="forgotpass.php">
                        <ul>
                        <li>Admin Name:<input name="admin" type="text"></li>
                        <li> E.mail: <input name="email" type="text"><br></li>  
                        </ul>
                        <input type="submit" name="get" value="get infos">
                        <input type="reset" name="reset" value="Reset">
                    </form>

so from it this data I get I can get the lost password

and this is the php codes

 <?php
    $con=mysqli_connect("rock","mido","1234","fyp");
    // Check connection
    if (mysqli_connect_errno())
      {
      echo "Failed to connect to MySQL: " . mysqli_connect_error();
      }

     $result = mysqli_query($con,"SELECT password FROM admin WHERE email = 'email', Admin = 'admin' ");
      while($row = mysqli_fetch_array($result))

    echo  $row['password'];

    mysqli_close($con);
    ?>

its giving me this error (mysql_fetch_array() expects parameter 1 to be mysqli_result).

thanx for your help

Replace this code :

$result = mysqli_query($con,"SELECT password FROM admin WHERE email = 'email', Admin = 'admin' ");

with

 $result = mysqli_query($con,"SELECT password FROM admin WHERE email = '$_POST[email]' AND Admin = '$_POST[admin]'");

Thanks.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM