Zdravim, muze mne nekdo poradit proc si mne v nasledujicim skriptu neulozi data do DB? Chyba neni zadna, do promennych se data ulozi ale do DB ne.
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "test";
$conn = new mysqli($servername, $username, $password,$dbname);
if ($conn->connect_error) {
die("</br>"."Připojení k db se nezdařilo " . $conn->connect_error);
}
else {echo "</br>"."pripojeno k DB";}
if (empty($_POST['jmeno']) || empty($_POST['prijmeni']) || empty($_POST['email'])) {
exit;
}
$jmeno = trim($_POST['jmeno']);
$prijmeni = trim($_POST['prijmeni']);
$email = trim($_POST['email']);
$dotaz = "INSERT INTO db VALUES (?, ?, ?)";
$a = $conn -> prepare($dotaz);
$a -> bind_param('sss',$jmeno,$prijmeni,$email);
$a -> execute;
if (($a -> affected_rows) > 0 ){
echo "</br>"."zaznamy byly ulozeny do DB";
}
else echo "</br>"."neco se porouchalo";