Databases: help me about coding

Databases: help me about coding

by Nutchada Kosumsawas -
Number of replies: 2

Hi all I'm a new moodle user. I would like to ask you if I have a code

>> $strSQL = "select subid,name from table1 where id = $id and stepid=$stepid";

How could I code in moodle style.

                                                                     Thanks

Average of ratings: -
In reply to Nutchada Kosumsawas

Re: Databases: help me about coding

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
You are probably looking for

$data = get_record('table1', 'id', $id, 'stepid', $stepid, '', '', 'subid,name');

the get_record function (and many others) are defined in lib/dmllib.php.