J'essaye de mettre une photo de ma BDD dans une page html en vain. Voici ce que j'ai fait.
Ma table:
id_location int
id_image int
chemin txt F:\documents\sites\dgls\photos\$id_image.jpg
Mon formulaire:
<?php include("../header.php"); ?>
<p>TAPEZ LE N° DE LA LOCATION
<form action="acces_location.php" method="GET">
<p>
<label for="id_location">Accés location</label> : <input type="text" name="id_location" $id="id_location"/><br /><br />
<input type="submit" value="Envoyer" />
</p>
</form>
</body>
</html>
la Requête:
<?php include("../header.php"); ?>
<?php include("../connect_wamp.php"); ?>
<?php
// On récupère le contenu de la table images
$req = $bdd->prepare('SELECT * FROM images WHERE id_location = :id_location');
$req->execute(array('id_location'=> $_GET['id_location']));
while ($donnees = $req->fetch())
{
echo ' ' . $donnees['<img src=chemin'] . ' ';
}
$req->closeCursor(); // Termine le traitement de la requête
?>
</body>
</html>
L'erreur, j'ai 3 photos dans la base donc 3 fois la même erreur.( ! ) Notice: Undefined index: <img src=chemin in C:\wamp\www\tests\dgls\proprio\acces_location.php on line 11
Call Stack
# Time Memory Function Location
1 0.0040 242696 {main}( ) ..\acces_location.php:0
Voila, j'espère avoir été suffisamment clair ? Merci de vos réponses.
Cordialement.