Developers notebook

Month: September 2013

Codeigniter populate dropdown from database


$data['city_list'] = $this->City_model->get_dropdown_list();
$this->load->view('my_view_file', $data); 


function get_dropdown_list()
$result = $this->db->get();
$return = array();
if($result->num_rows() > 0) {
foreach($result->result_array() as $row) {
$return[$row['id']] = $row['name'];

        return $return;



<?php echo form_dropdown('city_id', $city_list, set_value('city_id', $city_id));

Orignal source:



Find where Moodle 2+ has put your file

When you upload a file to a course it get assigned a hashvalue and stored in the /moodledata/filedir directory

To find out where, search the moodle database for the filename:

SELECT contenthash FROM mdl_files WHERE filename = ‘myfile.doc’;

This will return something like fb9d09535c7fce57abaa6f8a264137c39bea923b

Navigate to your moodledata/filedir and search for the hash:

find . -name fb9d09535c7fce57abaa6f8a264137c39bea923b

Take a copy, restoring the original name:

cp fb9d09535c7fce57abaa6f8a264137c39bea923b myfile.doc

© 2017

Theme by Anders NorenUp ↑