Dalsi postup...
Na synology jsem prepl na 5.6 PHP a
<?php
$mysqli = new mysqli('192.168.1.250','root','hesloDB','Domacnost', 3307);
if ($mysqli->connect_error) {
die('Connect Error (' . $mysqli->connect_errno . ') ' . $mysqli->connect_error);}
else {
echo 'connected'; }
?>
Vyslesledek :
connected
Ale kdyz chci zapsat do DB pomoci html s odkazem na php
<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf8">
</head>
<body>
<h1>Zapíše do databáze text vyplněný níže</h1>
<form action="test-insert.php" method="post">
Text: <input type="text" name="text" /><br><br>
<input type="submit" name="Zapsat do DB" />
</form>
</body>
</html>
<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf8">
</head>
<body>
<?php
$conn = mysqli_connect('192.168.1.250','root','hesloDB','test', 3307);
mysqli_query("SET NAMES 'utf8'");
mysqli_select_db("test", $conn);
$sql="INSERT INTO text (text) VALUES ('$_POST[text]')";
if (!mysqli_query($sql,$conn))
{
die('Chyba: ' . mysql_error());
}
echo "Zaznam pridan do tabulky test...";
mysqliclose($conn)
?>
</body>
</html>
tak ani prd