Reputation: 11
I have two tables resume_update and wp_rsjp_submissions
When I do a union of both tables I can fetch the records successfully but delete is not working. I have this query
<?php
include('wp-blog-header.php');
if($_POST['id']) {
$id=$_POST['id'];
//echo($id); enter code here
//$sql = "delete from user where id='$id'";`enter code here`global $wpdb;
$row = $wpdb->get_row("delete from wp_rsjp_submissions, resume_update using wp_rsjp_submissions, resume_update where id='$id'");
}
?>
Upvotes: 0
Views: 346
Reputation: 3070
Use the following code instead.
<?php
include('wp-blog-header.php');
if($_POST['id']) {
$id=$_POST['id'];
//echo($id); enter code here
//$sql = "delete from user where id='$id'";`enter code here`global $wpdb;
$sql = $wpdb->prepare("delete from wp_rsjp_submissions, resume_update using wp_rsjp_submissions, resume_update where id=%d" , array($id));
$return = $wpdb->query($sql);
}
?>
Also be sure to test your sql directly in mysql. I do not think this sql would work anyway.
Upvotes: 0