Press "Enter" to skip to content

Academy of Industry – Course Listings

if($_GET[‘course’]) {
$mycourseid = $_GET[‘course’];
print “

Course Information

“;
} else if($_GET[‘previous’]) {
print “

Previous “.date(“Y”,time()).” Courses

“;
} else {
print”

Upcoming Courses

The following is a list of upcoming courses. To register, visit the Academy inworld and click on the registration sign in the lobby.

“;
}
$debug = 1;
$con = mysql_connect(“newbabbage.powwebmysql.com”,”newbabbage”,”sprocket1!”);
if (!$con)
{
die(‘Could not connect: ‘ . mysql_error());
}
mysql_select_db(“citizens”, $con);
$datestamp = time();
if($mycourseid) {
$whereclause = “WHERE courseid = ‘”.$mycourseid.”‘ “;
} else if($_GET[‘previous’]) {
$whereclause = “WHERE start_time < '".$datestamp."' AND start_time > ‘1262322000’ “;
} else {
$whereclause = “WHERE start_time > ‘”.$datestamp.”‘ “;
}
$mycourselistquery = “SELECT * FROM courses “.$whereclause.” ORDER BY start_time ASC;”;
$mycourselistresult = mysql_query($mycourselistquery);
$i=0;
while($row = mysql_fetch_array($mycourselistresult)) {
$enrolledcount = 0;
$courseoutput[$i][‘course_name’] = $row[‘course_name’];
$courseoutput[$i][‘instructor’] = $row[‘instructor’];
$courseoutput[$i][‘start_time’] = $row[‘start_time’];
$courseoutput[$i][‘courseid’] = $row[‘courseid’];
$courseoutput[$i][‘max_enrollment’] = $row[‘max_enrollment’];
$courseoutput[$i][‘location_sim’] = $row[‘location_sim’];
$courseoutput[$i][‘location_coords’] = $row[‘location_coords’];
$courseoutput[$i][‘location’] = $row[‘location’];
$courseoutput[$i][‘course_description’] = $row[‘course_description’];
$courseoutput[$i][‘course_prereqs’] = $row[‘course_prereqs’];
$myattendeequery = “SELECT * from registration WHERE courseid = ‘”.$row[‘courseid’].”‘;”;
$myattendeeresult = mysql_query($myattendeequery);
while($attendeerow = mysql_fetch_array($myattendeeresult))
{
$courseoutput[$i][‘enrolledcount’] ++;
}
$i++;
}
mysql_close($con);
if(count($courseoutput) > 0) {
print “
“;
$i=0;while($i < count($courseoutput)) {
print “

“.$courseoutput[$i][‘course_name’].”

Instructor: “.$courseoutput[$i][‘instructor’].”
“.date(“F j”,$courseoutput[$i][‘start_time’]).” at “.date(“g:i a”,$courseoutput[$i][‘start_time’]).”
“.
$courseoutput[$i][‘course_description’].”
“;
if( $courseoutput[$i][‘course_prereqs’]) {print “Prerequisites: “.$courseoutput[$i][‘course_prereqs’].”
“;}
print ““;
if($courseoutput[$i][‘enrolledcount’] > 0 ) {
print $courseoutput[$i][‘enrolledcount’].” “;
if($courseoutput[$i][‘enrolledcount’] > 1){print “people”;} else {print “person”;}
print ” enrolled. “;
}
if($courseoutput[$i][‘start_time’] > time()) {
print “Please register inworld
“;
}
$i++;
print “

“;
print “

“;
}
} else {
print “More courses being prepared. Please check back soon.”;
}
?>

Be First to Comment

Leave a Reply