"; echo "email="; echo $email; echo "
"; echo "Going to connect...
"; require_once 'db_login.php'; // Connect to server $db_server = mysqli_connect($db_hostname, $db_username, $db_password, $db_database); // see comment in next section if (!$db_server) { die("Unable to connect to MySQL server " . $db_hostname); } else { echo "Connected to MySQL server " . $db_hostname . "
"; } // sql select command $query = "SELECT * FROM Persons WHERE LastName='$name'"; // create the sql command $result = mysqli_query($db_server, $query); // execute the sql command if (!$result) die ("Error executing sql command"); $rows = mysqli_num_rows($result); // get number of rows retrieved from the command echo "Retrieved " . $rows . " row(s)
"; for ($j=0; $j<$rows; $j++) { $record = mysqli_fetch_row($result); // get record $j echo 'PersonID: ' . $record[0] . '
'; echo 'FirstName: ' . $record[1] . '
'; echo 'LastName: ' . $record[2] . '

'; } ?>