Good day. I'm new to php and now wanted to learn on how to delete 3 tables from android to php by given a specific ID.
Table Info (id, name) Table Good (id, sun, tf) Table Bad (id, moon, ts)
<?php
//Getting Id
$id = $_GET['id'];
//Importing database
require_once('dbConnect.php');
//Creating sql query
$sql = "DELETE FROM info WHERE id=$id;";
$sql ="DELETE FROM Good WHERE tf=$id;";
$sql ="DELETE FROM Bad WHERE ts=$id;";
//Deleting record in database
if(mysqli_query($con,$sql)){
echo 'Employee Deleted Successfully';
}else{
echo 'Could Not Delete Employee Try Again';
}
//closing connection
mysqli_close($con);
?>
Error
Latest code
<?php
//Getting Id
$mysqli->multi_query(" Many SQL queries ; ");
$id = (int)$_GET['id'];
//Importing database
require_once('dbConnect.php');
//Creating sql query
$sql = "DELETE FROM informaation WHERE id=$id;";
$sql .= "DELETE FROM work_force WHERE twf=$id;";
$sql .= "DELETE FROM work_details WHERE ts_id=$id;";
//Deleting record in database
if(multi_query($con,$sql)){
echo ' Deleted Successfully';
}else{
echo 'Could Not Delete . Try Again.' . mysqli_error($con);
}
?>