I’m a newbie to Moodle and PHP so forgive me if I’m not making much sense
I want to create a block which will search a table in the database (which I have already created) and display the results from the search in a new page.
I have created some PHP code (from phpMyAdmin) of the queries that I wish to run but i don’t know how to write these queries within Moodle
The first one is
$sql = 'SELECT * FROM `mdl_block_archive` WHERE `title` LIKE \'%HTML%\' LIMIT 0, 30 ';
Where the LIKE clause is (\'%HTML%\) I would want to refer to the data from the form that the user has input
The second one is
$sql = 'SELECT * FROM `mdl_block_archive` WHERE `category` = \'Computing\' LIMIT 0, 30 ';
Any help please
Many thanks
Mark