search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

How to update through MySQLi

Asked by Sem Wong.
8 years ago.

Hey guys,

I'm trying to get the open-source version up, but I'm stumbling across some problems.
This is my update function:
function loadEvents() {
$.post("backend_events.php", // use "backend/events" for ASP.NET MVC
start: dp.visibleStart().toString(),
end: dp.visibleEnd().toString()
function(data) {
alert(data); = data;

This is backend_events.php:
require_once 'includes/';

$stmt = $db->prepare("SELECT * FROM `events` WHERE NOT ((`end` <= :start) OR (`start` >= :end))");

$stmt->bindParam(':start', $_POST['start']);
$stmt->bindParam(':end', $_POST['end']);


$result = $stmt->fetchAll();

class Event {}
$events = array();

foreach($result as $row) {
$e = new Event();
$e->id = $row['id'];
$e->text = $row['name'];
$e->start = $row['start'];
$e->end = $row['end'];
$events[] = $e;

echo json_encode($events);


it returns an array like this:
"text":"Calendar Event 1",

however, it gives me this error when I'm trying to use it:
Uncaught TypeError: Cannot read property 'getTime' of undefined in daypilot-all.min.js:8
loadEvents daypilot-all.min.js:8
init daypilot-all.min.js:8
update daypilot-all.min.js:8
(anonymous function) (index):111
c jquery-latest.js:3048
p.fireWith jquery-latest.js:3160
k jquery-latest.js:8235
r jquery-latest.js:8778

I have no clue how to fix this, i followed this guide:

with some changes i got the database to work (using PDO). for example I had to change backend_events.php because the data send was using the $_POST method and not the $_GET method.

Would really appriciate if someone could help me.

Sem Wong.

Answer posted by Dan Letecky [DayPilot]
8 years ago.

Can you try to download the sample PHP project from here?

The downloads include a working PHP project with all the features working.

Please let me know if you can see the error with the sample as well.

Comment posted by Sem Wong.
8 years ago.

Thank you, it worked :).

This question is more than 3 months old and has been closed. Please create a new question if you have anything to add.