PHP Code to avoid sql injection [duplicate]
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Best way to prevent SQL injection in PHP? This is my code $user_name = "admin"; $password = "123456"; $database = "jbit"; $server = "localhost"; $id = $_POST['id']; $db_handle = mysql_connect($server, $user_name, $password); $db_found = mysql_select_db($database, $db_handle); if ($db_found) { $SQL = "SELECT * FROM jbit WHERE htno='$id'"; $result = mysql_query($SQL); $sum = "SELECT htno, SUM(tm) AS tech, ROUND