简体   繁体   中英

Full calendar not updating to database

I've searched and tried just about everything I have come across with no luck. All of the proper parameters show up in the console log but somehow are not getting passed on to the database. Hoping someone can shed some light on this.

update.php

<?php

/* Values received via ajax */
$Job = $_POST['id'];
$date_assigned = $_POST['start'];

// connection to the database
try {
    $bdd = new PDO('mysql:host=localhost;dbname=service', 'root', 'root');
} catch(Exception $e) {
    exit('Unable to connect to database.');
}
    // update the records
    $sql = "UPDATE install SET date_assigned=? WHERE Job=?";
    $q = $bdd->prepare($sql);
    $q->execute(array($date_assigned,$Job));
?>
$.ajax({
    type: 'POST',
    url: 'update.php',
    data: 'title=' + info.event.title + '&start='+ start + '&id='+ info.event.id ,
    success: function(json) {
        console.log('succes:', info.event.title);
        console.log('start:', start);
        //console.log('Eind tijd:', info.event.end.toISOString().slice(0, 19).replace('T', ' '));
        console.log('ID:', info.event.id);
        console.log('auto:', recourceid);
        calendar.rerenderEvents();
    }
});

So, the answer for me was simple. There is no password set to my database and I was specifying one in my connection. Once I removed that it worked as expected. Thank you for the help. Sorry for wasting time on something silly that I should have caught.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM