Hello...
I'm trying to combine two chunks of code that I've worked on.
I'm using foreach to get contents of an xml file. Only it displays all of the records.
foreach($data->channel->item as $items) {
echo $items->title;
}
I'm using this code to show only the first 15 records from a different flat-text database.
$maxCount = 15;
$count = 0;
while ($count<$maxCount) {
$count++;
echo "some text";
}
My joining of the two loops has caused every result except the one that I want.
Hehehe...
This is the closest thing that I've found, but it displays the first record 5 times.
$maxCount = 15;
$count = 0;
foreach($data->channel->item as $items) {
while ($count<$maxCount) {
$count++;
echo $items->title;
}
}
I've looked at pagination, but I'm not really wanting to have all the records navigatable, just the first x number.
I thought a do/while loop would work, but I'm working with an array. My understanding is that foreach is what you want for that.
JJ