PDO syntax error

noxious

Registered
$query = $dbh->query("SELECT COUNT(id) AS rows FROM `news` WHERE category = ".$cat."");
$total = $query->fetch(PDO::FETCH_OBJ);

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 1' in E:\VertrigoServ\www\category.php on line 9
( ! ) PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 1 in E:\VertrigoServ\www\category.php on line 9

Това става само при:

RewriteRule ^category/c/(.+?)/p/(.+?)/?$ category.php?cat=$1?&page=$2

като отворя http://localhosts/category/c/4/p/1

иначе при http://localhost/category.php?cat=4&page=1 не дава грешка

Edit: Един "?" в .htaccess-а е правил всичко това, благодаря все пак!
 

Back
Горе