Bonjour a tous,
J'ais un petit soucis de syntaxe que je n'arrive pas a résoudre sur une requête.

Erreur retournée : 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','12'' at line 1

code :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
 
$dbr_add_cat = $connexion->prepare("SELECT id, titre, titre_url, contenu, cat, img_screen FROM fiche WHERE cat=:cat AND valid=:valid ORDER BY id  LIMIT :page,:limit");
		$dbr_add_cat -> bindValue(cat, $cat['id']);
		$dbr_add_cat -> bindValue(valid, 1);
		$dbr_add_cat -> bindvalue(page, $page_calc);
		$dbr_add_cat -> bindvalue(limit, 12);
		$dbr_add_cat -> execute();
		$fiches = array();
		while($cat_add = $dbr_add_cat->fetch())
			{
			$dbr_cat = $connexion->prepare("SELECT id, url, images, nom FROM categories WHERE id=:id");
			$dbr_cat -> bindValue( id, $cat_add['cat']);
			$dbr_cat -> execute();
			$cat = $dbr_cat -> fetch();
 
			$cat_add['id'];
			$cat_add['titre'];
			$cat_add['titre_url'];
			$cat_add['contenu'];
			$cat_add['cat'];
			$cat_add['img_screen'];
			$cat_add['cat_url'] = $cat['url'] ;
			$cat_add['cat_images'] = $cat['images'];
			$cat_add['cat_nom'] = $cat['nom'];
			$fiches[] = $cat_add;	
			}