0

please resolve the erroe

<?php //Grab User submitted information $firstname = &_POST["firstname"]; $lastname = &_POST["lastname"]; //connect to the database $con = mysqli_connect("localhost","root","","test"); //Make sure we connected successfully if(! $con) { die('connection Failed'.mysqli_error()); } //select the database to use mysqli_select_bd($con,"test"); $result = mysqli_query($con,"SELECT firstname, lastname FROM try WHERE firstname =$firstname and lastname = $lastname"); $row = mysqli_fetch_array($result); if($row["firstname"]==$firstname && $row["lastname"]==$lastname) echo"You are a validated user."; else echo"sorry, your credentials are not valid, Please try again."; ?> & the error is->Fatal error: Cannot use temporary expression in write context in C:\xampp\htdocs\kosis.php on line 3

7th Nov 2019, 1:48 PM
No Tension
No Tension - avatar
1 ответ
0
// replace &_POST -> $_POST $firstname = $_POST["firstname"]; $lastname = $_POST["lastname"]; //select the database to use //mysqli_select_bd -> mysqli_select_db mysqli_select_db($con,"test"); // add single quotes around // field values $result = mysqli_query($con,"SELECT firstname, lastname FROM try WHERE firstname ='$firstname' and lastname = '$lastname'");
7th Nov 2019, 2:05 PM
Ipang