I have this tiny table in my database:
----------------------
id | name | value
----------------------
1 | test.flag | 0
----------------------
2 | username | franz
----------------------
I simply try to read the value of test.flag and store the result into a variable.
<?php
$servername = "127.0.0.1";
$username = "test";
$password = "test123";
$dbname = "testdb";
$conn = mysqli_connect($servername, $username, $password, $dbname);
if (!$conn) {
die("Connection to database failed with error#: " . mysqli_connect_error());
}
$sql = "SELECT value FROM mytable WHERE name='test.flag';";
$result = mysqli_query($conn, $sql);
echo "<p>".$result."</p><br>";
if (mysqli_query($conn, $sql)) {
echo "<p>Sucessfully</p><br>";
} else {
echo "Error: " . $sql . "<br>" . mysqli_error($conn);
}
echo "<p>".$sql."</p><br>";
?>
But all it does is loading a blank page after I execute this script.