What I've managed to do is create my own multidimensional array....with a technique slightly different than i got from help on this site.
From there, what Im looking at doing is splitting the results by 3 to show 3 entries per page. Unfortunately, I can only get the first 3 entries to display. I've used
global $array;
global $newsarray;
$array = shift_array($newsarray)....
expecting the value of the arrays to change throughout the script.
Here we go:
PHP:
<?php
include 'db.php';
function test()
{
if ($GET['numrows']) {
$numrows = $GET['numrows'];
}//end if
$dbhost = "notshown";
$dbuser = "notshown";
$dbpass = "notshown";
$dbtable = "notshown";
$sql = "select * from earticles where bgroup='internet'";
$db1 = new DB();
$db1->connectMysqlDB($dbhost,$dbuser,$dbpass);
$db1->selectMysqlDB($dbtable);
$results = $db1->queryMysqlDB($sql);
if (! $numrows ) {
$numrows = mysql_num_rows($results);
}//end if
$numpage = ($numrows / 3);
//echo("numrows: ($numrows), numpage: ($numpage)<br>\n");
$newsarray=array();
$array1 = array();
global $array1;
global $newsarray;
while ($row = mysql_fetch_array($results, MYSQL_ASSOC))
{
$id = $row['id'];
$author = $row['author'];
$preview = $row['preview'];
$full = $row['full'];
$size = $row['size'];
$date = $row['date'];
$bgroup = $row['bgroup'];
$newsarray[$id] = array("$id","$author","$preview","$full","$size","$date","$bgroup");
}//end while
//$arraysize = count($newsarray);
//echo("count: ($arraysize)<br>\n");
while ($numpage >= 0) {
echo("numrows: ($numrows)\tdisplay single article<br>\n");
if ($numrows >= 3) {
for ($i=0; $i <= 2; $i++) {
$array1 = array_shift($newsarray);
$sarray1 = count($array1);
printArray($array1);
}//end for
$numrows = $numrows -3;
$numpage--;
echo("<strong><a href='http://www.winnipegbeach.com/elektrus/multiarray.php?numrows=$numrows'>More</a></strong><br>\n");
exit();
}//end if
elseif ( ($numrows > 0) && ($numrows < 3) ) {
for ($i=1; $i <= $numrows; $i++) {
$array1 = array_shift($newsarray);
$sarray1 = count($array1);
printArray($array1);
}//end for
$numrows = $numrows -3;
$numpage--;
echo("<strong><a href='http://www.winnipegbeach.com/elektrus/multiarray.php?numrows=$numrows'>More</a></strong><br>\n");
}//end for
exit();
}//end elseif
elseif ($numrows < 0) {
for ($i=0; $i <= $numrows; $i++) {
$array1 = array_shift($newsarray);
$sarray1 = count($array1);
printArray($array1);
}//end for
$numrows = $numrows -3;
$numpage--;
echo("<strong><a href='http://www.winnipegbeach.com/elektrus/multiarray.php?numrows=$numrows'>More</a></strong><br>\n");
}//end elseif
$numrows = $numrows -3;
$numpage--;
exit();
}//end while
}//end function test()
function printArray($array1) {
echo("in printarray($array)<br>\n");
foreach($array1 as $index => $value) {
echo("in printarray: ($index), ($value)<br>\n");
}//end foreach
}//end function printArray($newsarray)
RESULTS
array1: (0), (3)
array1: (1), (Chris Gauthier)
array1: (2), (Another article about NHL Hockey)
array1: (3), (This is the article about the bumbs who have not appreciable skills)
array1: (4), (2000)
array1: (5), (2005-02-15 11:12:11)
array1: (6), (internet)
size of array1: (7)
array1: (0), (6)
array1: (1), (Chris Gauthier)
array1: (2), (NHL Article)
array1: (3), (This is the nhl on strike)
array1: (4), (1500)
array1: (5), (2005-02-16 11:12:12)
array1: (6), (internet)
size of array1: (7)
array1: (0), (7)
array1: (1), (Chris Gauthier)
array1: (2), (NHL Article)
array1: (3), (This is the nhl on strike)
array1: (4), (1500)
array1: (5), (2005-02-16 11:12:12)
array1: (6), (internet)
size of array1: (7)
More[next 3, etc]
Now, these results are good...but I need the next 3 rows of the table to show on a click of the more.
Anyhelp would be lovely.
Thanks.