I am trying to figure out how to get the return value to post. My code is as follows
<?php
$mysqli = new mysqli("localhost","user","password","db");
$lname=$_POST['lname'];
$query= "SELECT * FROM contacts WHERE lname = '".$lname."'";
$result = $mysqli->query($query);
if (!$result) {
printf("Query failed: %s\n", $mysqli->error);
exit;
}
return $result;
?>
I am pretty new to php, but what i am doing is getting a name posted to the php file, it then goes to the database, finds all values that have the last name inputted, and then i want it to return the values and then print them
See mysqli_result::fetch_assoc