Go Back   SitePoint Forums > Forum Index > Program Your Site > PHP
Newsletter FAQ Members List Calendar Mark Forums Read

New to SitePoint Forums? Register here for free!

SitePoint Sponsor
 
Reply
 
Thread Tools Display Modes
Old Nov 4, 2005, 05:34   #1
segdoune
SitePoint Member
 
Join Date: Nov 2005
Posts: 6
Should be simple, but

Hi all,
I need some help with what should be an easy problem for those in the know.
To be honest I have extremely little knowledge of php and usually get by with trial and error.
I admin a UK fishing site and require a menu generated from the database to print in the order that the data is entered.
http://www.fish4ituk.co.uk/magazine/...zine/index.php
On this page the menu is on the left with the last entered topic at the top, i.e. competitions. The first entered topic was Brenig.
I need to reverse the way it prints to the page with Brenig being at the top and competition at the bottom.
This as far as I’m aware is the code bit that prints the menu.
<?
$temp = '<tr><td bgcolor="#f0f0f0" width="150" style="padding-left:5px;">&middot; &nbsp;&nbsp;<a href="GROUP_LINK" class="menuSkupina" style="color:black;">GROUP_NAME</a></td></tr>';
$temp .= '<tr><td bgcolor="#999999" height="1"></td></tr>';
ShowNewsGroups(1,0,$temp);
?>

Can anyone point me in the right direction?
Keep smiling
Colin
scotland
segdoune is offline   Reply With Quote
Old Nov 4, 2005, 06:31   #2
iamoraal
SitePoint Member
 
Join Date: Jan 2002
Posts: 12
Don't know if I can help you, but the code you provided may display the menu, but "ShowNewsGroups(1,0,$temp)" is a call to a function that displays the menu. You need to post the code for this function for us to be able to help.

Irvin.
iamoraal is offline   Reply With Quote
Old Nov 4, 2005, 06:31   #3
a.dotty.dot
SitePoint Addict
 
Join Date: Nov 2005
Posts: 328
It's a safe bet that the function ShowNewsGroups() has an SQL query in it, unless it's some kind of phpBB-style spaghetti code. What you need to do is find "DESC" in that query and change it to "ASC".
a.dotty.dot is offline   Reply With Quote
Old Nov 4, 2005, 06:53   #4
segdoune
SitePoint Member
 
Join Date: Nov 2005
Posts: 6
Hi,
Thanks for the help so far.
As you will have guessed i know very little about this.
Ive read through a php tutorial but I was looking for an answer rather than learning it.
i think this is the code that generates the data, this is taken from the admin side of things.
<td align="right"><?=_SUBMITEDCATEGORY.": ".$num;?></td>
</tr>
</table>

<form action="<?=$GLOBALS['PHP_SELF'];?>" name="myform" method="post">
<table width="630" cellspacing="2" cellpadding="1" class="MojText">
<tr bgcolor="#<?=_COLOR02;?>">
<td><font color="#<?=_COLOR05;?>"><?=_OPTIONS;?></font></td>
<td><font color="#<?=_COLOR05;?>"><?=_NAME;?></font></td>
<td><font color="#<?=_COLOR05;?>"><?=_NUMBER;?></font></td>
<td><font color="#<?=_COLOR05;?>"><?=_IMAGE;?></font></td>
<td><font color="#<?=_COLOR05;?>"><?=_CHECK;?></font></td>
</tr>
<?php
$res = mysql_query("SELECT * from ".$GLOBALS['db_topic']." LIMIT $myopt[0],$myopt[1]");
while ($ar = mysql_fetch_array($res))
{
$res2 = mysql_query("SELECT * from ".$GLOBALS['db_news']." where category = $ar[id]");
$num = mysql_num_rows($res2);
?>
<tr>
<td width="44">
<a href="<?=$GLOBALS['PHP_SELF'];?>?action=edit&amp;id=<?=$ar[id];?>"><img src="gfx/edit.gif" alt="" width="20" height="20" border="0"/></a>
<a href="javascript:Confirm('<?=$GLOBALS['PHP_SELF'];?>?action=delete&amp;id=<?=$ar[id];?>','<?=_DELETE.": ".eregi_replace("'","\'",$ar[topictext])."?";?>');"><img src="gfx/trash.gif" width="20" height="20" border="0" alt="" /></a>
</td>
<td valign="top"><?=$ar[topictext];?></td>
<td valign="top"><?=$num;?></td>
<td valign="top" width="100"><img height="20" src="<?=$GLOBALS['topic_url']."/".$ar[topicimage];?>" alt="" /></td>
<td valign="top" align="center" width="40"><input type="checkbox" name="list[]" value="<?=$ar[id];?>"/></td>
</tr>

The scripts are from a web magazine thing taken from http://www.skintech.org/webmag/
keep smiling
colin
scotland
segdoune is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread | Next Thread »

Thread Tools
Display Modes

 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Sponsored Links
 
Forum Jump


All times are GMT -7. The time now is 15:03.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Copyright 1998-2009, SitePoint Pty Ltd. All Rights Reserved