dimanche 30 avril 2017

how to use single delete page for deleting data from mulltiple pages in php using sql

<?php
 include('connect.php');
  if(empty($_REQUEST['b-id']))
 {
$id=$_REQUEST['id'];
$query="delete from contact where id='$id'";
$data=mysqli_query($con,$query);
    if($data>=1)
    {
        echo "<script>
        alert('Data Deleted Suceefully');
        window.location.href='user-queries.php';
        </script>";
    }
    else
    {
        echo "<script>
        alert('Process Failed');
        window.location.href='user-queries.php';
        </script>";
    }
}
 elseif(empty($_REQUEST['id']))
   {
   $bid=$_REQUEST['b-id'];
   $query1="delete from registration where id='$bid'";
   $data1=mysqli_query($con,$query1);
    if($data>=1)
    {
        echo "<script>
        alert('Data Deleted Suceefully');
        window.location.href='all-builders.php';
        </script>";
    }
    else
    {
        echo "<script>
        alert('Process Failed');
        window.location.href='all-builders.php';
        </script>";
    }
}

?>

In this, i am trying to delete rows from multiple pages by redirecting then on a single page.. but the problem is that when it redirects it deletes the data but also shows an error while it is not getting the another data.. if condition is also not working.. what to do and how to.

Aucun commentaire:

Enregistrer un commentaire