xyn Posted September 5, 2007 Share Posted September 5, 2007 Hey Guys, I've never been so involved in Arrays before however i've hit a learning curve. because I need to achive the following: [0] => 'SQL_ID', 'SQL_NAME', 'SQL_FILE_NAME', [1] => 'SQL_ID', 'SQL_NAME', 'SQL_FILE_NAME', [2] => 'SQL_ID', 'SQL_NAME', 'SQL_FILE_NAME' And so one... Basically I am taking images from my database and displaying them in rows of 5. but using while to loop the sql results. and trying to make colums i found the only way is using and array My coding is this... Show: $arr = array(); $arr_count = 0; while($photo_album = mysql_fetch_array($sql_display_albums)) { $arr = array(); } echo("<table width=\"607\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">"); include($_SERVER['DOCUMENT_ROOT'] . "/includes_files/album.inc.php"); echo("</table>"); album.inc.php: <?php $total_albums = count($main_array); for($i=0; $i<$total_albums; $i++) { if($ii == 0) { echo("<tr>"); } if($ii <= 7) { echo("<td width=\"110\" height=\"100\" align=\"center\" class=\"text\">".$photo_album['']."<br>".$photo_album['']."</td> <td width=\"14\" height=\"100\" align=\"center\" class=\"text\"> </td>"); } if($ii == 7) { echo("</tr> <tr> <td height=\"5\" width=\"607\" colspan=\"9\"></td> </tr>"); $ii = 0; } } ?> Quote Link to comment Share on other sites More sharing options...
xyn Posted September 5, 2007 Author Share Posted September 5, 2007 I kinda thought about this hard; and thought of building an array in my while like while($data = mysql_fetch_array($sql)) { $arr[] = array('".$data['id']."', '$data['name']', '$data['file']'); } then implode(); the $arr into another array sorry for time wasting 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.