Here is the solution for you
$sql="SELECT count(*) FROM [tablename] WHERE key == ? ";
$sth = $this->db->prepare($sql);
$sth->execute(array($key));
$rows = $sth->fetch(PDO::FETCH_NUM);
echo $rows[0];
More Related Contents:
- PDOException SQLSTATE[HY000] [2002] No such file or directory
- PDO get the last ID inserted
- PDO mysql: How to know if insert was successful
- MySQL check if a table exists without throwing an exception
- Fetching single row, single column with PDO
- How to connect to mssql using pdo through PHP and Linux?
- Replacing mysql_* functions with PDO and prepared statements
- PDO::PARAM for type decimal?
- Using LIKE in bindParam for a MySQL PDO Query [duplicate]
- pdo sqlite could not find driver… php file not processing
- Is it ” RTSi6+yxLwIW7KsnoehVDA== ” md5? or How to get original string? [closed]
- save user images in MYSQL database by which method? [closed]
- How to apply bindValue method in LIMIT clause?
- Importing CSV data using PHP/MySQL
- How to debug PDO database queries?
- PDO multiple queries
- Get last insert id after a prepared insert with PDO
- Do SQL connections opened with PDO in PHP have to be closed
- What is the advantage of using try {} catch {} versus if {} else {}
- ERROR: SQLSTATE[HY000] [2002] No connection could be made because the target machine actively refused it
- Call to undefined method PDO::execute()
- return one value from database with mysql php pdo
- Trying to access array offset on value of type bool
- How to get a query error from prepare() in PDO PHP?
- How can I pass an array of PDO parameters yet still specify their types?
- mysql injection damages?
- PHP Laravel: No connection could be made because the target machine actively refused it
- What is the PDO equivalent of function mysql_real_escape_string?
- Installing PDO driver on MySQL Linux server
- PDO Exception Questions – How to Catch Them