I have got my results back fine and now i am trying to format them to display properly - i did have them working as i wanted at one point and then *ahem* over wrote the code and had to start all over again.....
this is where i am now and i have come to a brick wall... this is how i want my results to look...
[1] Home
[2] About Us
etc
etc
Each item title being a link - I need the [1] and [2] [etc] to increment per row result and will also need the same number to be inserted into the link as an accesskey="x"
Hope that makes sense....
The code i been have working on without the incremented numbers looks like this...
Code: Select all
function getMobimenus() {
global $database;
$sql = 'SELECT * FROM jos_menu WHERE menutype = \'mobimenu\' AND published = 1 ORDER BY ordering ASC';
$database->setQuery( $sql );
$rows = $database->loadObjectList();
foreach ( $rows as $row )
echo "[**** need incremented number here****] <a href=\"$row->link\" accesskey=\"**** need incremented number here****\">$row->name</a><br/>\n";
}
getMobimenus();
Code: Select all
$i=1;
while($i<=5)
{
echo "[" . $i . "]";
$i++;
}
also i found a similar example on another site
Code: Select all
$result = mysql_query($sql);
$thenumber = 1;
while ($row = mysql_fetch_array ($result)) {
echo $thenumber . ' - ' . $row['name'];
$thenumber++;
}