Guest Posted March 21, 2005 Share Posted March 21, 2005 Hi, Just a little query, I am making a system for the admin area of cubecart so that the admin of the site can add news and it will be posted on the main page. I will try and explain in as much detail as possible. Here goes, I have my database 'simfree_chadwicks' and the table 'store_news' with the fields 'id' 'date' 'news'. The 'id' field automatically counts from 1 upwards and gives the news an ID number. In news.php (it displays the information from the database) the results are ordered by id. Now here is my problem, when it loads the information from the database it shows the oldest record first, how do I make it show the latest addition first? Here is my code: $query= "SELECT * FROM ".$prefix."store_news where id > 0 LIMIT 5"; $result = mysql_query($query); $total_rows = mysql_num_rows($result); while($row = mysql_fetch_array($result)) { $id=$row["id"]; $date1=$row["date"]; $news=$row["news"]; if($total_rows==0) { echo"No news at the moment"; } if($total_rows>0) { // start table to display news ?> <p align="left"> <u> <?php echo "$date1"; ?> </u>:<br><br> <?php echo "$news"; ?> </p> <br> <?php } } //end ?> Any help is grately appreciated. Regards, Paul Quote Link to comment Share on other sites More sharing options...
Guest Posted March 21, 2005 Share Posted March 21, 2005 No problem now, I sorted that one but now I have another... When I enter the information into the database I need to use the HTML (<br>) code to make it goto a new line, why doesn't it do it automatically? Also, I want to be able to edit posts that have been made, how would I do this? When I get it all working correctly I will be providing it as a Free Mod in the downloads section, so any help would be appreciated... Finally, I am looking for a HTML editor that I can encorperate into the thing so that any novice user can use it. Cheers, Paul Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.