bonjour a tous je commence recement a travailler sur php et j'essaye de recuperer les resultat renvoyer par une fonction affichelivre() ensuite afficher les image qui correspand a chaque livre mais il m'affiche que le 1er livre pouvet vous m'aider voici ma fonction
et voici comment j'essayer de la recuperer et afficher
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11 function affichelivre(){ $connection=mysql_connect("localhost", "root", ""); mysql_select_db("bibliotheque"); $requete="select * from livres "; $resultat=mysql_query($requete,$connection); $res=mysql_fetch_array($resultat); return $res; }
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6 <?php $tab=affichelivre(); foreach($tab as $j) $photo = $tab['image']; ?> <img src="res\img-books\<?php echo "$photo" ?>"/>;
Partager