
Untitled
By: a guest on
Apr 17th, 2012 | syntax:
None | size: 0.80 KB | hits: 9 | expires: Never
What should I do with the database when I create a course in PHP with Moodle?
public function createCourse()
{
//find category
//calculate sortorder i.e. search in mdl course for all course with category. select sortorder MAX then ++
require "/mysqli_connect.php";
$t = time();
$insert_q = "INSERT INTO mdl_course
(category, fullname, shortname, summary, startdate, maxbytes,
timecreated, newsitems, numsections, expirythreshold)
VALUES (30, 'Fullname', 'shortname', 'This is the summary', '$t', 268435456, '$t', 5, 10, 864000)";
$insert_r = mysqli_query($mysqli, $insert_q);
$insert_n = mysqli_affected_rows($mysqli);
//var_dump($insert_n);
if($insert_n == 1)
{
return true; //insert successful
}
else
{
return false;
}
}