mercredi 28 novembre 2018

'Fatal error' in html website, call to a member function bind_param

I need help debugging my code, I want to be pushing variables into table that I have created. The error is enter image description here

Festivals_update:

    <?php
include('config.php');

$stmt = $mysqli->prepare("INSERT INTO Festivals(name, location, weekend, day, date, month, genre, size) VALUES (?,?,?,?,?,?,?,?)");
$stmt->bind_param('ssddssss', $_POST['name'], $_POST['location'], $_POST['weekend'], $_POST['day'], $_POST['date'], $_POST['month'], $_POST['genre'], $_POST['size']);

$stmt->execute();
$stmt->close();

echo "The festival has been added";
?>

filter_script.js:

  function upload2(){
    alert("test");
    var name = document.getElementById("name").value;
    var location = document.getElementById("location").value;
    var weekend = document.getElementById("weekend").value;
    var day = document.getElementById("day").value;
    var date = document.getElementById("date").value;
    var month = document.getElementById("month").value;
    var genre = document.getElementById("genre").value;
    var size = document.getElementById("size").value;
       $.ajax({
        url: "Festivals_update.php",
        cache: false,
        type: 'post',
        data: { name: name, location: location, weekend: weekend, day: day, date: date, month: month, genre: genre, size: size },

         success: function(data) {
        alert(data)
        }
       })
    //alert("success")
  }




Aucun commentaire:

Enregistrer un commentaire