日期:2014-05-17 浏览次数:20634 次
public function Account($name, $password) { $sql="select member_id from gm_member where email='mygirl' and password='25d55ad283aa400af464c76d713c07ad'"; //$sql = "SELECT member_id FROM " . __DB_PREFIX__ . "member WHERE email='" . $name . "' AND password='" . $password . "'"; //$sth = $this->prepare ( $sql ); //$sth->execute (); $stmt = $this->prepare ( $sql ); if (! $stmt->execute ()) { throw new Exception ( join ( ' ', $stmt->errorInfo () ) ); } [color=#FF0000]$result = $stmt->fetch(PDO_FETCH_ASSOC); print_r($result);[/color]看看有结果不! return ($stmt->rowCount () == 1) ? true : false; } }
------解决方案--------------------
public function Account($name, $password) { $sql="select member_id from gm_member where email='mygirl' and password='25d55ad283aa400af464c76d713c07ad'"; //$sql = "SELECT member_id FROM " . __DB_PREFIX__ . "member WHERE email='" . $name . "' AND password='" . $password . "'"; //$sth = $this->prepare ( $sql ); //$sth->execute (); $stmt = $this->prepare ( $sql ); if (! $stmt->execute ()) { throw new Exception ( join ( ' ', $stmt->errorInfo () ) ); } $result = $stmt->fetch(PDO_FETCH_ASSOC); print_r($result); return ($stmt->rowCount () == 1) ? true : false; } }
------解决方案--------------------
$sql = "SELECT member_id FROM " . __DB_PREFIX__ . "member WHERE email=" . $name . " AND password'" . $password . "";
------解决方案--------------------
$sql = "SELECT member_id FROM " . __DB_PREFIX__ . "member WHERE email=" . $name . " AND password=" . $password ;