I'm not sure if it's out there yet, but I need to add some code to my page so it will display the contents of my multidimensional array 5 rows at a time...
My array is set us as follows...
// Set up query...
$results = mysql_query("SELECT * FROM apartments");
// Establish how many rows were returned...
$totalrows = mysql_num_rows($results);
// Start moving rows through loop...
if($myrow = mysql_fetch_array($results))
{
$i = 0;
do
{
// Load information from query and new variable into array
$output[$i][0] = $i;
$output[$i][1] = $myrow['AptID'];
$output[$i][2] = $myrow['AptAddress'];
$output[$i][3] = $myrow['AptApt'];
$output[$i][4] = $myrow['AptCity'];
if($i<$totalrows)
{
$i = ($i+1);
}
}
while ($myrow = mysql_fetch_array($results));
}
else
{
echo "Sorry Charlie";
}
Now I know adding $i to the array as $output[$i][0] is a little bit funky, but let me explain...
I have made this as a test page before I start messing with the actual page I'll be publishing...
In that one, instead of populating $output[$i][0] with $i, it will be with a variable that is set through an include file in the loop. This include file takes the current value of $myrow['ApdID'] and runs it through a few logical statements to get $new_var which is a number...
So the actual code will be as follows...
do
{
// Get $new_var from include...
$aptID = $myrow['AptID'];
include("new_var.php");
// Load information from query and new variable into array
$output[$i][0] = $new_var;
$output[$i][1] = $myrow['AptID'];
$output[$i][2] = $myrow['AptAddress'];
$output[$i][3] = $myrow['AptApt'];
$output[$i][4] = $myrow['AptCity'];
Anyways...
When I display the array in a table, I don't want all of the results all at once...
I need, say, 5 rows at a time...
I have figured out how to paginate the results from a MySQL query. Unfortunately a key part of that is using LIMIT in the actual query...
Can't really do that here...
So I'm going to spend the day writing code to get the same results for an array...
If anyone already knows how, I would appreciate some advice...
Otherwise, I should have this working soon, and when I do, I'll post how...
Thanks for everyone's help so far...!!!