dropfaith Posted September 5, 2008 Share Posted September 5, 2008 Okay So what im trying to do isnt easy for me to explain. Im trying to make a gallery page that pulls data from two databases the first database galleryname needs to be looped to get all the gallery names to display and the about then the other gallery holds the uploaded image for a thumbnail of the set. im sure im way off on how im doing it so i need alot of help example here http://dropfaithproductions.com/test/gallery.php <?php // includes include("template/conf.php"); // open database connection $connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!"); // select database mysql_select_db($db) or die ("Unable to select database!"); // generate and execute query $query = "SELECT * FROM galleryname,gallery"; $result = mysql_query($query) or die ("Error in query: $query. " . mysql_error()); // if records present if (mysql_num_rows($result) > 0) { // iterate through resultset // print article titles while($row = mysql_fetch_object($result)) { ?> <div align="left"> <div class="header" style="width:100%;background-color:#ccc;color:#000;"><? echo $row->Gallery; ?></div> <div class="image" style="width:150px;float:left;"><img style="width:145px;" src="http://www.dropfaithproductions.com/test/images/<? echo $row->uploaded; ?>"></div> <div class="text" style="float:right:width:500px;"><? echo $row->About; ?></div> </div><div style="clear:both;"> </div> <? } } // if no records present // display message else { ?> <font size="-1"></font> <? } // close database connection mysql_close($connection); ?> Link to comment https://forums.phpfreaks.com/topic/122823-loops/ Share on other sites More sharing options...
Ken2k7 Posted September 5, 2008 Share Posted September 5, 2008 SELECT * FROM `galleryname` INNER JOIN `gallery` ON ( conditions ) Link to comment https://forums.phpfreaks.com/topic/122823-loops/#findComment-634283 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.