我尝试一个接一个地执行3个查询,但它只执行2并且没有任何错误... 它只回显第一个然后什么都没有,当通过phpMyAdmin查看表时,我看到没有插入任何行(最后查询)。
$queryGetOpis = $con->query('SELECT numar FROM Opis ORDER BY id ASC LIMIT 1');
$data = $queryGetOpis->fetch_assoc();
$numar = intval($data["numar"])+1;
echo '<h2>Numarul este ' . $numar . '</h2>';
if ($queryUpdateOpis = $con->prepare('UPDATE Opis SET numar=' . $numar . ' ORDER BY id ASC LIMIT 1'))
{
$queryUpdateOpis->execute();
$queryUpdateOpis->close();
}
else echo "Eroare ".$con->error;
if ($queryInsertUser = $con->prepare('INSERT INTO Opis(numar,user,data) VALUES(' . $numar . ', "' . $_COOKIE[LOGIN_COOKIE] . '", "' . date("dmYHi") . '")'))
{
$queryInsertUser->execute();
$queryInsertUser->close();
}
else echo "Eroare ".$con->error;