mofm Posted April 22, 2008 Share Posted April 22, 2008 Im makeing a image gallery and im using an array to organise all my data i want each indervidual album to go acroos the mage like this : Album album2 album image album image album description ablumb decription etc etc ... i only want 4 to show on any one row Well hers my code and it only returns 1 row (4) albums when there is 7 in the database: <table width="650" border="0"> <?php require '../includes/functions.php'; require '../includes/connect.php'; require '../includes/settings.php'; session_start(); /************************************************************ Adjust the headers... ************************************************************/ header("Expires: Thu, 17 May 2001 10:17:17 GMT"); // Date in the past header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header ("Pragma: no-cache"); // HTTP/1.0 $album_id=""; if(empty($album_id)) { $albums_query = "SELECT * FROM albums"; if($albums_result=mysql_query($albums_query)) { $counter=0; $albums=array(); $set=0; while($albums_array=mysql_fetch_array($albums_result)) { if ($counter%4==0 && !$counter==0) { $set++; } $albums[$set][$counter][0]=$albums_array['name']; $albums[$set][$counter][1]=$albums_array['description']; $albums[$set][$counter][2]=$albums_array['userid']; $albums[$set][$counter][3]=$albums_array['image']; $albums[$set][$counter][4]=$albums_array['user']; $albums[$set][$counter][5]=$albums_array['date']; $albums[$set][$counter][6]=$albums_array['id']; $counter++; } $setcount=0; while ($setcount<=$set) { $counter2=0; $rowcounter=0; while ($rowcounter<7) { while($counter2<4) { echo "<td colspan=\"3\">".$albums[$setcount][$counter2][$rowcounter]."</td>"; $counter2++; } echo"</tr><tr>"; $rowcounter++; $counter2=0; } $setcount++; } }else{ //sqlerror } } ?> </table> Quote Link to comment Share on other sites More sharing options...
jonsjava Posted April 22, 2008 Share Posted April 22, 2008 nothing huge, but I noticed that your session_start() isn't coming first. It should. I'm looking at the rest of the code now. Quote Link to comment Share on other sites More sharing options...
jonsjava Posted April 22, 2008 Share Posted April 22, 2008 Well, any which way I flip it, syntacticly, it's accurate. Functionally, I can't say. I guess it's up to someone else. sorry. Quote Link to comment Share on other sites More sharing options...
mofm Posted April 22, 2008 Author Share Posted April 22, 2008 well thanks for looking anyway anyone else any ideas thanks mofm Quote Link to comment Share on other sites More sharing options...
mofm Posted April 22, 2008 Author Share Posted April 22, 2008 can no one here help me then ? Quote Link to comment Share on other sites More sharing options...
mofm Posted April 23, 2008 Author Share Posted April 23, 2008 somone must know :S ? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.