28 lines
742 B
PHP
28 lines
742 B
PHP
<?php
|
|
|
|
// Basic example of PHP script to handle with jQuery-Tabledit plug-in.
|
|
// Note that is just an example. Should take precautions such as filtering the input data.
|
|
|
|
//header('Content-Type: application/json');
|
|
|
|
include('db-connect.php');
|
|
|
|
$input = filter_input_array(INPUT_POST);
|
|
|
|
if ($input['action'] === 'edit')
|
|
{
|
|
$sql = "UPDATE contacts SET idtrf ='" . $input['idtrf'] . "', kindofcontacts='" . $input['kindofcontacts'] . "'" ." , companyname='" . $input['companyname'] . "'" ." WHERE idcontacts='" . $input['id'] . "'";
|
|
|
|
mysqli_query($con,$sql);
|
|
}
|
|
if ($input['action'] === 'delete')
|
|
{
|
|
mysqli_query($con,"DELETE FROM contacts WHERE id='" . $input['id'] . "'");
|
|
}
|
|
|
|
|
|
mysqli_close($mysqli);
|
|
|
|
echo json_encode($input);
|
|
?>
|