Cytat(viking @ 1.01.2022, 14:48:21 )

No i sam widzisz że nie masz tam żadnego wyniku.
Zobacz tak wygląda cała moja funkcja:
Kod
<?php
$conn = mysqli_connect("myxt8.pl", "m262xst", "x$", "mxest");
if($conn === false)
{
die("ERROR: Could not connect. " .mysqli_connect_error());
}
$query="SELECT * FROM stat";
$result=mysqli_query($conn, $query);
function validation_sql($c, $sql)
{
if(mysqli_query($c, $sql))
{
echo nl2br("$TemperaturePot1\n $TemperaturePot2\n $TemperaturePot3\n $TemperaturePot4\n $HumidityPot1\n $HumidityPot2\n $HumidityPot3\n $HumidityPot4\n $TemperatureWaterPot1\n $TemperatureWaterPot2\n $TemperatureWaterPot3\n $TemperatureWaterPot4\n $pHPot1\n $pHPot2\n $pHPot3\n $pHPot4");
}
else
{
echo "ERROR: Hush! Sorry $sql. "
.mysqli_error($c);
return 'false';
}
}
$sql = "INSERT INTO `stat` (TemperaturePot1, TemperaturePot2, TemperaturePot3, TemperaturePot4, HumidityPot1, HumidityPot2, HumidityPot3, HumidityPot4, TemperatureWaterPot1, TemperatureWaterPot2, TemperatureWaterPot3, TemperatureWaterPot4, pHPot1, pHPot2, pHPot3, pHPot4) VALUES (11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26)";
if(isset($_POST['passed_exam']))
{
echo validation_sql($conn, $sql);
}
while ($row = mysqli_fetch_row($result))
{
printf("%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s", $row[0], $row[1], $row[2], $row[3], $row[4], $row[5], $row[6], $row[7], $row[8], $row[9], $row[10], $row[11], $row[12], $row[13], $row[14], $row[15]);
}
$TemperaturePot1 = (int) filter_input(INPUT_POST, 'TemperaturePot1', FILTER_SANITIZE_NUMBER_INT);
$sql="update stat set TemperaturePot1 = " . $TemperaturePot1 . " where id=1;";
echo validation_sql($conn, $sql);
$TemperaturePot2 = (int) filter_input(INPUT_POST, 'TemperaturePot2', FILTER_SANITIZE_NUMBER_INT);
$sql="update stat set TemperaturePot2 = " . $TemperaturePot2 . " where id=1;";
echo validation_sql($conn, $sql);
$TemperaturePot3 = (int) filter_input(INPUT_POST, 'TemperaturePot3', FILTER_SANITIZE_NUMBER_INT);
$sql="update stat set TemperaturePot3 = " . $TemperaturePot3 . " where id=1;";
echo validation_sql($conn, $sql);
$TemperaturePot4 = (int) filter_input(INPUT_POST, 'TemperaturePot4', FILTER_SANITIZE_NUMBER_INT);
$sql="update stat set TemperaturePot4 = " . $TemperaturePot4 . " where id=1;";
echo validation_sql($conn, $sql);
$HumidityPot1 = (int) filter_input(INPUT_POST, 'HumidityPot1', FILTER_SANITIZE_NUMBER_INT);
$sql="update stat set HumidityPot1 = " . $HumidityPot1 . " where id=1;";
echo validation_sql($conn, $sql);
$HumidityPot2 = (int) filter_input(INPUT_POST, 'HumidityPot2', FILTER_SANITIZE_NUMBER_INT);
$sql="update stat set HumidityPot2 = " . $HumidityPot2 . " where id=1;";
echo validation_sql($conn, $sql);
$HumidityPot3 = (int) filter_input(INPUT_POST, 'HumidityPot3', FILTER_SANITIZE_NUMBER_INT);
$sql="update stat set HumidityPot3 = " . $HumidityPot3 . " where id=1;";
echo validation_sql($conn, $sql);
$HumidityPot4 = (int) filter_input(INPUT_POST, 'HumidityPot4', FILTER_SANITIZE_NUMBER_INT);
$sql="update stat set HumidityPot4 = " . $HumidityPot4 . " where id=1;";
echo validation_sql($conn, $sql);
$TemperatureWaterPot1 = (int) filter_input(INPUT_POST, 'TemperatureWaterPot1', FILTER_SANITIZE_NUMBER_INT);
$sql="update stat set TemperatureWaterPot1 = " . $TemperatureWaterPot1 . " where id=1;";
echo validation_sql($conn, $sql);
$TemperatureWaterPot2 = (int) filter_input(INPUT_POST, 'TemperatureWaterPot2', FILTER_SANITIZE_NUMBER_INT);
$sql="update stat set TemperatureWaterPot2 = " . $TemperatureWaterPot2 . " where id=1;";
echo validation_sql($conn, $sql);
$TemperatureWaterPot3 = (int) filter_input(INPUT_POST, 'TemperatureWaterPot3', FILTER_SANITIZE_NUMBER_INT);
$sql="update stat set TemperatureWaterPot3 = " . $TemperatureWaterPot3 . " where id=1;";
echo validation_sql($conn, $sql);
$TemperatureWaterPot4 = (int) filter_input(INPUT_POST, 'TemperatureWaterPot4', FILTER_SANITIZE_NUMBER_INT);
$sql="update stat set TemperatureWaterPot3 = " . $TemperatureWaterPot3 . " where id=1;";
echo validation_sql($conn, $sql);
$pHPot1 = (int) filter_input(INPUT_POST, 'pHPot1', FILTER_SANITIZE_NUMBER_INT);
$sql="update stat set pHPot1 = " . $pHPot1 . " where id=1;";
echo validation_sql($conn, $sql);
$pHPot2 = (int) filter_input(INPUT_POST, 'pHPot2', FILTER_SANITIZE_NUMBER_INT);
$sql="update stat set pHPot2 = " . $pHPot2 . " where id=1;";
echo validation_sql($conn, $sql);
$pHPot3 = (int) filter_input(INPUT_POST, 'pHPot3', FILTER_SANITIZE_NUMBER_INT);
$sql="update stat set pHPot3 = " . $pHPot3 . " where id=1;";
echo validation_sql($conn, $sql);
$pHPot4 = (int) filter_input(INPUT_POST, 'pHPot4', FILTER_SANITIZE_NUMBER_INT);
$sql="update stat set pHPot4 = " . $pHPot4 . " where id=1;";
echo validation_sql($conn, $sql);
$sql = <<<SQL
SELECT
`TemperaturePot1`,
`TemperaturePot2`,
`TemperaturePot3`,
`TemperaturePot4`,
`HumidityPot1`,
`HumidityPot2`,
`HumidityPot3`,
`HumidityPot4`,
`TemperatureWaterPot1`,
`TemperatureWaterPot2`,
`TemperatureWaterPot3`,
`TemperatureWaterPot4`,
`pHPot1`,
`pHPot2`,
`pHPot3`,
`pHPot4`
FROM `stat`
SQL;
$sql = <<<SQL
UPDATE `stat` SET
`TemperaturePot1` = ?,
`TemperaturePot2` = ?,
`TemperaturePot3` = ?,
`TemperaturePot4` = ?,
`HumidityPot1` = ? ,
`HumidityPot2` = ?,
`HumidityPot3` = ?,
`HumidityPot4` = ?,
`TemperatureWaterPot1` = ?,
`TemperatureWaterPot2` = ?,
`TemperatureWaterPot3` = ?,
`TemperatureWaterPot4` = ?,
`pHPot1` = ?,
`pHPot2` = ?,
`pHPot3` = ?,
`pHPot4` = ?
LIMIT 1;
SQL;
$stmt = mysqli_prepare($conn, $sql);
mysqli_stmt_bind_param
(
$stmt, 'iiiiiiiiiiiiiiii', $TemperaturePot1, $TemperaturePot2, $TemperaturePot3, $TemperaturePot4, $HumidityPot1, $HumidityPot2, $HumidityPot3, $HumidityPot4, $TemperatureWaterPot1, $TemperatureWaterPot2, $TemperatureWaterPot3, $TemperatureWaterPot4, $pHPot1, $pHPot2, $pHPot3, $pHPot4
);
mysqli_stmt_execute($stmt);
$res = mysqli_query($conn, $sql);
while($foo = mysqli_fetch_row($res))
{
echo $foo[0];
}
$rows = mysqli_fetch_all($result, MYSQLI_NUM);
?>