SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens on line 102 [closed]

You didn’t bind all your bindings here

$sql = "UNIX_TIMESTAMP(publicationDate) AS publicationDate
        FROM comments WHERE articleid = :art 
        ORDER BY some LIMIT :numRows";

$st = $conn->prepare( $sql );
$st->bindValue( ":art", $art, PDO::PARAM_INT );

You’ve declared a binding called :numRows but you never actually bind anything to it.

Leave a Comment