删除查询正在执行,但记录被删除,表格为空

Each time "Removed!!!" is the result.... $na is declared in au.php ... Perhaps the DELETE query might be having problem..

<?php
date_default_timezone_set('Asia/KolKata');
$xyz = date(DATE_RFC2822);
include "../au.php";

$conn = mysql_connect('localhost', 'local', 'local');
mysql_select_db('sol_index', $conn);
$sid = $_GET['sid'];
$qqq = "SELECT * FROM $sid WHERE (one = '$na' AND three = 'liked')";

if (mysql_query($qqq)){
    mysql_query("DELETE FROM $sid WHERE (one='$na' AND three='liked')");
    echo "Removed!!!";
} else {
    mysql_query("INSERT INTO $sid (one, three) VALUES ('$na', 'liked')");
    echo "Liked!!!";
}

?>

Thanks for the cordination and help !!

Each time "Removed!!!" is the result

Rightly so.

$qqq = "SELECT * FROM $sid WHERE (one = '$na' AND three = 'liked')";
if (mysql_query($qqq)){
    mysql_query("DELETE FROM $sid WHERE (one='$na' AND three='liked')");
    echo "Removed!!!";
} 

That if is incorrect, it will always return true as long as the query is valid, even if there is no data. You need to run that check on the number of records or the records themselves, and not just on the execution. For example You have to fetch data from that result and run your check on that.

How can I prevent SQL injection in PHP?