samedi 23 juillet 2016

Insert into database won't work no error [duplicate]

This question already has an answer here:

When I try to add data to my database I don't get an error but the date isn't added. But selecting data does work.

This code works.

<?php
// connectie maken
include('configdb.php');

// selecteren van rijen uit tabel
$sql = "SELECT artikelnummer, merk, prijs FROM koeling";
$result = $mysqli->query($sql);

    // data weergeven in apparte divs
    while($row = $result->fetch_assoc()) {
        echo "id: " . $row["artikelnummer"]. " - Name: " . $row["merk"]. " " . $row["prijs"]. "<br>";
    }
// connectie afsluiten
$mysqli->close();
?>

This one doesn't.

<?php
// connectie maken
include('configdb.php');

mysqli_query("INSERT INTO koeling (merk, prijs, beschikbaarheid, type) VALUES ('test', '100', '10', 'test')");

$mysqli->commit();
$mysqli->close();
?>

Aucun commentaire:

Enregistrer un commentaire