SQL functions

SQL functions

by Teemu Sumi -
Number of replies: 1
Is there a function to do this?

$sql="SELECT MIN(id) AS smallest, MAX(id) AS biggest FROM mdl_some_table";
$result=mysql_query($sql);
$line=mysql_fetch_object($result);


I want to make Moodle like code smile


Teemu Sumi
Average of ratings: -
In reply to Teemu Sumi

Re: SQL functions

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
$info = get_record_select("some_table", "", "MIN(id) AS smallest, MAX(id) AS biggest");
echo $info->smallest;
echo $info->biggest;