I have this PHP (testing):
<?php
if (isset($_POST['submit'])) {
$link = mysqli_connect("localhost","php","","A");
$query = "SELECT passport FROM users WHERE mail = '$_POST[mail]';";
$result = $link->query($query);
}
?>
A manual SELECT using the same $query shows:
mysql> SELECT passport FROM users WHERE mail = '[email protected]';
+----------------------+
| passport |
+----------------------+
| 8KQSWCZPJAUV1M9D4TFG |
+----------------------+
1 row in set (0.00 sec)
I am trying to echo the $result in PHP which should show 8KQSWCZPJAUV1M9D4TFG but it is null. What am I doing wrong here?
Update:
<?php
if (isset($_POST['submit'])) {
$link = mysqli_connect("localhost","php","","A");
$query = "SELECT passport FROM users WHERE mail = '$_POST[mail]';";
$result = mysqli_query($query);
$row = mysqli_fetch_assoc($result);
echo $row["passport"];
}
?>
This also is still null.