Question: Write a delete function to the post.. which will deleted the post that is been added in the database. Below code is the auth.php $mysqli

Write a delete function to the post.. which will deleted the post that is been added in the database.

Below code is the auth.php

$mysqli = new mysqli('localhost', 'root', 'seedubuntu', 'root');

if($mysqli->connect_error){ die(' error: ' . $mysqli->connect_error); } function checklogin($username,$password){ $sql = "SELECT * FROM users WHERE username='$username' AND password=password('$password');"; echo "sql= $sql"; global $mysqli; $result = $mysqli->query($sql); if($result->num_rows ==1 ) return TRUE; } return FALSE;

}

Write a delete function to the post.. which will deleted the post

?php require auth.php $mysqli new mysqli(' localhost root 'seedubuntu', project mysql connect error die(' Connection to the database has error: $mysqli connect error) $nane nysgl real escape string(htnlentities($ POSTC 'name $content mysql real escape string (htnlentities POST content $submit mysql real escape string (htnlentities($ POSTC' subnit'])) echo $username if(isset ($submit)) if ($nane && Scontent)f ..i $segl INSERT INTO posts (title content, tine, owner) VALUES ('Snane 'Scontent', now(), 'Susernane $result $nysqli- query ($sql) if $result) echo Your reply has been saved header ('Location: index.php'); else{ echo result echo "problem with query"; else{ echo one or nore fields are empty else echo "Your reply has been saved

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!