I am using the bootstrap table, I have seen an example where this table can be edited. I tried to edit the table with PHP and MySQL but I do not get results.
I've looked at this documentation but I do not get the desired results, I can see the data but not edit it.
my code
<table data-pagination="true" data-search="true"
data-toggle="table"
data-url="controller/fetch.php"
data-pagination="true"
data-editable-url="controller/update.php">
<thead>
<tr>
<th id="code" data-sortable="true" data-field="Code" >Code</th>
<th id="name" data-editable="true" data-field="Name">Name </th>
<th id="mail" data-field="Mail" data-editable="true">Mail</th>
</tr>
</thead>
</table>
javascritps
$('#name').editable({
container: 'body',
selector: 'td.Name',
url: "controller/update.php",
title: 'Employee Name',
type: "POST",
dataType: 'json',
validate: function(value) {
if ($.trim(value) == '') {
return 'This field is required';
}
}
});
PHP
<?php
$query = "
UPDATE personal SET ".$_POST["name"]." = '".$_POST["value"]."'
WHERE Code = '".$_POST["pk"]."'";
mysqli_query($conn, $query);
?>
I hope to have explained myself well and if someone has the way to do the editing I would appreciate the help a lot.