This page will delete a post:
require_once ('db.php');
$db = new DB();
$db->deletePost($_GET['id'], $_GET['postType']);
db.php only contains a class which called DB and its functions.
this is a part of db.php:
public function deleteComment($post_id, $post_type)
{
$query = "delete from t_comments where c_type = '$post_type' and c_id = '$post_id';";
$this->execute($query);
}
public function deletePost($post_id, $post_type)
{
deleteComment($post_id, $post_type);
$query = "delete from t_news where n_id = '$post_id';";
$this->execute($query);
}
Then mysql says: Fatal error: Call to undefined function deletecomment() in db.php on line 70
I defined deleteComment above the deletePost!So what's the problem?Can't I call another function of a class in that class?But in C++, I think it is possible!
SQL injectionGETfor your database manipulations; it might cause a search engine or a browser accelerator to wipe out your database.