Jump to content

Help with MySQL/PHP


blurd

Recommended Posts

I'm making a news script for my site and everything works, like i have the script reading the data from the database and everything.  BUT, every time i add new news, it gets put under the old ones and i want it on top.  Here is my script and thanks to anyone who helps.

[CODE]<?php
include 'config.php';
include 'opendb.php';

$query  = "SELECT Username,Date,Time,Title,Content FROM news";
$result = mysql_query($query);

while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
echo "<TABLE WIDTH='100%' BORDER=0 CELLPADDING=2 CELLSPACING=0><TR style='text-align:center;vertical-align:middle;font-size:12pt;font-weight:bold;'><TD width='15%' style='font-size:10pt;border-left:1px solid black;border-bottom:1px solid black;border-top:1px solid black;'>$row[Date] At $row[Time] </TD><TD width='70%' style='border-top:1px solid black;border-bottom:1px solid black;'> $row[Title] </TD><TD width='15%' style='font-size:10pt;border-right:1px solid black;border-bottom:1px solid black;border-top:1px solid black;'> By: $row[Username]</TD></TR><TR style='text-align:center;vertical-align:middle;font-size:10pt;'><TD width='15%' style='border-left:1px solid black;border-bottom:1px solid black;'>&nbsp</TD><TD width='70%' style='border-bottom:1px solid black;'> $row[Content] </TD><TD width='15%' style='border-right:1px solid black;border-bottom:1px solid black;'>&nbsp</TD></TR></TABLE><BR>";
}

include 'closedb.php';
?>
[/CODE]
Link to comment
https://forums.phpfreaks.com/topic/17579-help-with-mysqlphp/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.