<?php?header('Content-type: text/html; charset=UTF8'); $name = $_POST['name']; $password = $_POST['password'];? ? include('../../data/sql.php');? ? //選擇連接數(shù)據(jù)庫(kù)的文件? $row_column= $pdo->query("select * from mysql where name = '$name' and password = '$password'");? ?//向表查詢賬號(hào)和密碼????//$row_column是從數(shù)據(jù)庫(kù)傳回的list(rows),不能做布爾型的判斷。?//但是我們可以通過list中的object元素的個(gè)數(shù)來做布爾判斷其中fetchColumn()函數(shù)用于獲取row的個(gè)數(shù)
我的PHP PDO 寫法怎么防不了 SQL注入
慕UI1458911
2017-10-10 18:42:14