[RESOLU] Fatal error

Répondre


Cette question est un moyen d’empêcher des soumissions automatisées de formulaires par des robots.
Smileys
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen: =D> #-o =P~ :^o :non: :priere: 8-|
Voir plus de smileys
  Revue du sujet
 

  Étendre la vue Revue du sujet : [RESOLU] Fatal error

Re: Fatal error

par Henrigo » 10 juil. 2016, 22:01

Merci bien Mammouth
c'etait cela .

Re: Fatal error

par or 1 » 10 juil. 2016, 21:57

si la requete sql est invalide, $req vaux false. une raison peut être l'absence d'un espace avant un and.

Fatal error

par Henrigo » 10 juil. 2016, 21:42

Salut a tous je ne comprend pas mon script produit.php
lorsque qu'une erreur est corrige une nouvelle apparait je ne comprend pas ce qui ce passe alors que j'ai encore des modifications a faire je ne comprend pas cette erreur.

Fatal error: Call to a member function fetch() on boolean in C:\xampp\htdocs\kant\produits.php on line 17
<?php
require_once 'connection.php';
$sql = 'select * from produit where 1=1';
if (isset($_POST['motCle'])) {
    $sql .= ' and designation LIKE '.$dbConnect->quote('%'.$_POST['motCle'].'%');
}
if (isset($_GET['idCat'])) {
    $sql .= 'and code_cat='.$dbConnect->quote($_GET['idCat']);
}
$req = $dbConnect->query($sql);
?>

<div id="produits">

<?php

while($prod=$req->fetch(PDO::FETCH_ASSOC)) {               //la ligne 17

?>

	<div id="produit" align="center">
	
		<form method="post" action="formular.php">
		<table>

				<td><a>Pos.Nr. / Kantt-Nr.</a></td>
				<td><input type="text" name="postnr_kanttnr" size="60" required="required"></td>

			</tr>

			<tr>

				<td><a>Bezeichnung:</a></td>
				<td><input type="text" name="bezeichnung" size="60" required="required"></td>

			</tr>

			<tr>

				<td><a>Farbe:</a></td>
				<td><input type="text" name="farbe" size="60" required="required"></td>

			</tr>

			<tr>
				<td><a>Anzahl x Länge:</a></td>
				<td><input type="text" name="anzahl_laenge" size="60" required="required"></td>

			</tr>

			<tr>
				<td><a>Bemerkung:</a></td>
				<td><input type="text" name="bemerkung" size="60" required="required"></td>

			</tr>

			
			<tr>
				<td></td>
				<td rowspan="1" align="center"><img src="images/<?php echo $prod['photo']?>"></td>

			</tr>

			

			<tr>

				<td><h3>Designation:</h3></td><td width="100px"><h3><?php echo $prod['DESIGNATION']?></h3></td>

			</tr>
         

			<tr>	
				<td><a>a</a><input type="text" name="a" size="4"  required="required" ></td>				               
				<td><a>b</a><input type="text" name="b" size="4"  required="required"></td>
			</tr>
		
		    <tr>
				<td><a>c</a><input type="text" name="c" size="4"  required="required"></td>				
                <td><a>d</a><input type="text" name="d" size="4"  required="required"></td>
			</tr>

			<tr>
				<td><a>e</a><input type="text" name="e" size="4" required="required"></td>
				<td><a>f </a><input type="text" name="f" size="4" required="required"></td>
			</tr>
			
			<tr>	
				<td><a>g</a><input type="text" name="g" size="4" required="required"></td>				
				<td><a>α</a><input type="text" name="alpha" size="4" required="required"></td>
			</tr>
		
			<tr>
				<td colspan="4" align="right">
					<div id="formPanier">
						<form method="post" action="addCaddie.php" id="form2">
						     
							<input type="text" name="quantite" size="4" value="1"/>
							
						
							
							<input type="hidden" name="designation" value="<?php echo $prod['DESIGNATION']; ?>" />
							
						
							<input type="image" src="images/korb.jpg" value="submit" align="right"/>
							</tr>
						</form>
					</div>
					<input type="hidden" name="idCat" value="<?php echo $idCat; ?>">  
				</td>
			</tr>
			<tr>

				<td></td><td align="right"><br><input type="submit" name="produit_erstellen" value="Speichern"></td>

			</tr>
		</table>

		
		</form>
	</div>
<?php

}

?>

</div>