Wednesday 30 October 2013

Moodle course list in every where for custom php

You can copy & paste following php code for every where
 
$con = mysql_connect("hostname","username","password");
if (!$con) {
die('Could not connect: ' . mysql_error());
}
mysql_select_db("moodledatabase", $con) or die(mysql_error());
$query_course_list = "SELECT c.id AS courseid, c.fullname FROM mdl_course c where category != 0";
$courses = mysql_query($query_course_list);
$output = '';
echo $output;