correcting the connection when querying the database
This commit is contained in:
@@ -21,9 +21,9 @@ if ($conn->connect_error) {
|
||||
echo "Connected successfully";
|
||||
|
||||
$query = "Select * from contacts where fname = {$fname} and lnam = {$lname}";
|
||||
mysqli_query($db, $query) or die('Error querying database.');
|
||||
mysqli_query($conn, $query) or die('Error querying database.');
|
||||
|
||||
$result = mysqli_query($db, $query);
|
||||
$result = mysqli_query($conn, $query);
|
||||
$row = mysqli_fetch_array($result);
|
||||
|
||||
while ($row = mysqli_fetch_array($result)) {
|
||||
@@ -31,7 +31,7 @@ while ($row = mysqli_fetch_array($result)) {
|
||||
}
|
||||
|
||||
|
||||
mysqli_close($db);
|
||||
mysqli_close($conn);
|
||||
?>
|
||||
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user