this is my code :
$sql="SELECT duration,address,roozhaye_bargozari, ";
$sql.="ostan_name,city_name,cluster_name,education_node.name ";
$sql.="FROM class ";
$sql.="LEFT JOIN education_cluster ec ON ec.id=class.cluster_id ";
$sql.="LEFT JOIN education_node ON education_node.id=class.node_id ";
$sql.="LEFT JOIN ostan ON ostan.id=class.ostan_id ";
$sql.="LEFT JOIN city ON city.id=class.city_id ";
$sql.="WHERE class.master_id=? LIMIT ?,?";
$result=$db->prepare($sql);
$result->execute(array($master_id,$startpos,$endpos));
$final_result=$result->fetchAll(PDO::FETCH_ASSOC);
when i use this code , this error message apear: 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 ''0','2'' at line 1 in C:\wamp\www\fani\inc\class\user.php on line 239
but if i use this :
.
.
.
$sql.="WHERE class.master_id=? LIMIT $startpos,$endpos";
$result=$db->prepare($sql);
$result->execute(array($master_id);
$final_result=$result->fetchAll(PDO::FETCH_ASSOC)
the code run correctly, whats the problem?