Page 1 sur 1

Probleme requete

Posté : 27 mai 2007, 20:41
par Dom!
Bonsoir,

Je fais cette requete :
$sqlequ = 'select tb_cat_photo.id_cat_photo, tb_cat_photo.cat, tb_photos.id, tb_photos.photo_p, tb_photos.photo_g, tb_photos.commentaire, tb_photos.nom_fichier, tb_photos.visible, tb_photos.id_cat_photo
			    from tb_cat_photo, tb_photos
				where tb_photos.id_cat_photo = tb_cat_photo.id_cat_photo
				and tb_.id_equipe = '.$id_test;

				if ($resselectequ = mysql_query($sqlequ)) {
			         $selectequ = mysql_fetch_array($resselectequ);
				}
Y'a t-il un moyen pour faire la meme chose mais sans selectionner un id en l'occurence dans mon exemple id_test ???

je veux afficher tous les enregistrements de ma table et non pas que id_test !

Merci pour votre aide..... :D

Posté : 27 mai 2007, 21:49
par Cyrano
Ben supprime la dernière clause WHERE et traite le retour dans une boucle, tout simplement :
<?php
$sqlequ = 'select tb_cat_photo.id_cat_photo, tb_cat_photo.cat, tb_photos.id, tb_photos.photo_p, tb_photos.photo_g, tb_photos.commentaire, tb_photos.nom_fichier, tb_photos.visible, tb_photos.id_cat_photo
           from tb_cat_photo, tb_photos
           where tb_photos.id_cat_photo = tb_cat_photo.id_cat_photo';

if ($resselectequ = mysql_query($sqlequ)) 
{
    while(false != ($selectequ = mysql_fetch_array($resselectequ)))
    {
        /* Tout se trouve maintenant dans $selectequ, donc $selectequ['tb_cat_photo'], etc... */
    }
}

?>

Posté : 28 mai 2007, 11:01
par Dom!
Merci c'est parfait :D