Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $sql = "SELECT * FROM classposts where branch='$branch' and joindate='$year' and class='$class' order by".$orderby." desc";
- $result = $connection->query($sql);
- if(isset($_SESSION['username'])){
- $username=$_SESSION['username'];
- }
- while($row = $result->fetch_assoc()) {
- echo "<span id='postspan".$row['id']."' name='postspan".$row['id']."' >";
- echo "<span id='editspan".$row['id']."' name='editspan".$row['id']."' >";
- echo "-----------------------------------</br>";
- echo "-----------------------------------</br>";
- echo "Posted By: ".$row['user']."    ";
- if($username==$row['user']){
- echo "<a href='classwall.php' onclick='deletepost(".$row['id'].")' >DELETE POST</a>   ";
- }
- function deletepost(postid){
- var r=confirm("Are you sure you want to delete the post?");
- if(r==true){
- var xmlhttp=new XMLHttpRequest();
- xmlhttp.onreadystatechange=function() {
- if (xmlhttp.readyState==4 && xmlhttp.status==200) {
- document.getElementById("postspan"+postid).innerHTML=xmlhttp.responseText;
- }
- };
- xmlhttp.open("GET","deletepost.php?pid="+postid,true);
- xmlhttp.send();
- }else{}
- }
- $pid=$_GET['pid'];
- $query="delete from dubiousposts where id='$pid'";
- $sql=mysqli_query($connection,$query);
- $query="delete from genuineposts where id='$pid'";
- $sql=mysqli_query($connection,$query);
- $query="delete from posts where id='$pid'";
- $sql=mysqli_query($connection,$query);
- if($result=mysqli_fetch_array($sql)){
- echo "";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement