-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug_insert.php
More file actions
33 lines (31 loc) · 999 Bytes
/
debug_insert.php
File metadata and controls
33 lines (31 loc) · 999 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
require 'includes/config.php';
require 'includes/progress_helper.php';
$username = 'test_user';
$courseId = 'TEST_COURSE';
$toolId = 1;
$activityType = 'test_activity';
try {
echo "Attempting insert...\n";
$success = markActivityComplete($con, $username, $courseId, $toolId, $activityType);
if ($success) {
echo "Success!\n";
} else {
echo "Failed. Check error log.\n";
// Let's try to get the error explicitly
$stmt = $con->prepare(
"INSERT INTO user_course_progress
(username, course_id, tool_id, activity_type, is_completed, completed_at)
VALUES (?, ?, ?, ?, 1, NOW())
ON DUPLICATE KEY UPDATE
is_completed = 1,
completed_at = NOW()"
);
if (!$stmt->execute([$username, $courseId, $toolId, $activityType])) {
print_r($stmt->errorInfo());
}
}
} catch (Exception $e) {
echo "Exception: " . $e->getMessage() . "\n";
}
?>