Usman Qadeer Usman Qadeer - 1 year ago 132
SQL Question

I want to select a record from moodle database

I want to select id from moodle database where name is equal to some variable.I am trying this statement but so far its not working.

$questionname= $DB->get_record_sql('SELECT id
FROM {question} WHERE name = ?', array($name));

Answer Source
$questionid = $DB->get_field('question', 'id', array('name' => $name));

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download