0
pdoエラーが発生する理由がわかりません。またはパラメータ(唯一の2があるので)未知PDOException:SQLSTATE [HY093]:無効なパラメータ番号:バインドされた変数の数がトークンの数と一致しません
public function does_stringid_excist($strTable, $strColumn, $strValue)
{
$sql = "SELECT count(1) AS count FROM tblemployer WHERE :strColumn = :strValue";
$this->objDatabase->query($sql); //Makes a prepare with the given sql
// $this->objDatabase->bind_column(':strTable', $strTable);
$this->objDatabase->bind_column(':strColumn', $strColumn); // Uses the `bindColumn()` from PDO
$this->objDatabase->bind_value(':strValue', $strValue); // Uses the `bindValue()` from PDO
$result = $this->objDatabase->single();
return $result['count'];
}
SELECT count(1) AS count FROM `tblemployer` WHERE `employerID` = :strValue"
ので、エラーが値ではないだけで正常に動作します。
テーブルをバインドしようとすると、同じエラーが表示されます。 – Wanjia