Try doing print_r($row); in your while loop and see what exactly is in that array. Ken On Tue, Apr 29, 2008 at 1:46 PM, Jon L. <jonllmsed@xxxxxxxxx> wrote: > I could be wrong, but I don't think table aliases continue to exist in PHP; > only the column names. > > $g_name = $row["gigName"]; > $vname = $row["venueName"]; > $genre = $row["name"]; > > > You may also consider revising the query to only grab the columns you need, > using an alias for at least genre.name. > > $query = 'SELECT gig.gigName AS gig, venue.venueName AS venue, genre.name AS > genre FROM `gig` LEFT JOIN genre ON gig.genreId=genre.genreId LEFT JOIN > > venue ON gig.venueID = venue.vid where gig.gigid = '.$gigDetail.' ORDER BY > gig.gigid'; > > $result = mysql_query($query) or die(mysql_error()); > while ($row = mysql_fetch_array($result)) > { > echo "Program is in While loop"; > $g_name = $row["gig"]; > $vname = $row["venue"]; > $genre = $row["genre"]; > > echo("Gig Name: ".$g_name); > } > > > - Jon L. > > > On Tue, Apr 29, 2008 at 1:27 PM, Nasreen Laghari <nasreen_laghari@xxxxxxxxx> > wrote: > > > > > Hi, > > Why my program is not going in while loop? When I run the same query in > > SQL cmd, it brings result but here when I print $result gives Resouce ID > > number means $result has data then why $row is empty. > > $query = 'SELECT * FROM `gig` LEFT JOIN genre ON gig.genreId=genre.genreId > > LEFT JOIN venue ON gig.venueID = venue.vid where gig.gigid = '.$gigDetail.' > > ORDER BY gig.gigid'; > > > > $result = mysql_query($query) or die(mysql_error()); > > while ($row = mysql_fetch_array($result)) > > { > > echo "Program is in While loop"; > > $g_name = $row["gig.gigName"]; > > $vname = $row["venue.venueName"]; > > $genre = $row["genre.name"]; > > echo("Gig Name: ".$g_name); > > } > > Regards > > Nasreen > > > > > > > > ____________________________________________________________________________________ > > Be a better friend, newshound, and > > know-it-all with Yahoo! Mobile. Try it now. > > http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ > > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php