
However, I can only get the array to find one attribute from a table (thumblink). I want to get both the thumblink AND id number so I can link the thumbnails to their respective pages.
I have no idea how to get the array to get two attributes from each row.
Any help would be awesome.
Code: Select all
while($invitationsloop = mysql_fetch_array($returned_data)) {
$arr[] = $invitationsloop[thumblink];
}
$max_num_cols = 3; //the maximum amount of columns that can be output
$min_items_per_col = 1; //The minimum amount of items per column
$col_limit_calculation = $max_num_cols * $min_items_per_col; //used to determine which value to chunk by
$num_rows = count($arr); //total number of items in the array
//determins how many values to chunk our array by while still keeping with our $max_num_cols
$chunk_count = ($num_rows >= $col_limit_calculation) ? ceil(($num_rows / $max_num_cols)) : $min_items_per_col;
//The chunked array that we get to loop through now
$alphabet_chunk_array = array_chunk($arr, $chunk_count);
echo "<table border='1' width='100%'><tr>";
foreach ($alphabet_chunk_array as $alphabet_array) {
echo "<td width='33%' valign='top'>";
foreach ($alphabet_array as $alphabet) {
echo "<a href='showinvite.php?id='3''><img src='" .$alphabet . "'></a><br />";
}
echo "</td>";
}
echo "</tr></table>";