Hello, I am using the mosaddphp mambot to create articles using dynamic content from other tables I have added to the mambo database. What I was wondering is how do I get the field names? I am using the following syntax:
Code:
PHP Code:
$content = "";
$query = "SELECT * FROM #__blah ORDER BY blah ASC";
$database->setQuery($query);
$rows =$database->loadObjectList();
$content .="<table cellpadding=\"1\" border=\"0\">";
foreach($rows as $row) {
$content .="<tr><td valign=\"top\"><img src=\"$mosConfig_live_site/images/M_images/arrow.png\" alt=\"\" /></td>";
$content .="<td>".$row->blah." ".$row->Last_Name."</td><td>"
.$row->blah."</td><td>"
.$row->blah."</td><td>"
.$row->blah."</td></tr>";
}
$content .="</table>";
echo $content;
This works very nicely, but I do not know how to get the field names so I can add them to the output.
Also I was trying to get {mospagebreak} to work with this so that the output would be spread across several pages. I used the following code:
PHP Code:
$count++;
if ($count % 30 == 0)
echo "{mospagebreak}";
I declared the $count variable above the first line of my script, and then added the bit of code above as the first thing inside the foreach statement.
When I run it, I get a blank page with the proper number of pagination links on the bottom. If I try to go to the next page it says:
You are not authorized to view this resource.
How do I fix this? And get the fieldnames?