I recently bought QNAP with Webserver and SQL Server. I'm still a bitt of a noob and learning.
I have the Webserver running, as well Maria DB running, and able to acces the database by MyPHP in the webserver or by MySQLWorkbench on my local computer. Am running Maria DB 10 over port 3307.
That's great. But strugling with the PHP Script to connect to the database. I think it is connection because status is database connection is ok. The database is filled with records. And if I run my query in WOrkbench it generates 1 record as result.
But nothing is echoo't after the database connection ok. Also simple print statements. Also tried to insert a table same result. No results at all.
Can anyone help?
Thanks in advance
Code: Select all
$dbconnect=mysqli_connect($hostname,$username,$password,$db);
if ($dbconnect->connect_error) {
die("Database connection failed: " . $dbconnect->connect_error);
}else{ echo "Database connection ok";}
$sql = $dbconnect->query("SELECT Temperature, Humidity, DateTime FROM Home.Kitchen order by DateTime desc Limit 1");
$result = $mysqli->query($sql);
if ($result->num_rows > 0) {
echo "Row";
}