0
require_once (__DIR__ . '/../../config.php');
global $DB,$CFG;

$id = required_param('id', PARAM_INT);

$table='blocks_table';

if ($id === 0) {
   echo 'data not present';
}else{
   $DB->delete_records($table, array('id' => $id));
   return redirect($CFG->wwwroot.'/my/index.php');

My Mustache Code Below

<h1>List of Picture</h1>
{{#show}}
<div class="card mt-2 mb-2">
    <div class="card-body">
        <p><img src="{{ message }}"></p>
        <input type="button" class="btn btn-danger" value="Delete message/{{id}} onclick='?id'{{id}}>
    </div>
</div>
{{/show}}

I Am trying delete record against a specific id, i try but stuck to this as i am new to php and moodle.

0 Answers0