leeboycymru
Programmer
I have a page that is outputting news vertically, and its ordering oldest first most recent last, and i would prefer the opposite.
The code is below:
<?php
include "config.php";
session_start();
include("config.php");
$sid=session_id();
$date=date("Y-m-d");
$sql="select * from usr where sid='$sid' AND ddate='$date' AND pageno=14";
$q=mysql_query($sql) or die(mysql_error());
$c=mysql_num_rows($q);
$usrcnt=0;
if($c<1)
{
$q1=mysql_query("insert into usr(sid,ddate,pageno) values('$sid','$date',14)") or die (mysql_error());
$q3=mysql_query("select count(*) from usr where pageno=14") or die (mysql_query());
$r3=mysql_fetch_row($q3);
$usrcnt=$r3[0];
}
else
{
$q2=mysql_query("select count(*) from usr where pageno=14") or die (mysql_query());
$r2=mysql_fetch_row($q2);
$usrcnt=$r2[0];
}
?>
and here is code on the page:
<!-- news starts -->
<?
$qu=mysql_query("select * from tbl_news") or die (mysql_error());
while($r=mysql_fetch_assoc($qu))
{?>
<tr>
<td><div align="justify"><span class="thomsan">
<?= $r['Nom_New'] ?>
</span><span class="innerpagetext"><br/>
<?= $r['Desc_New'] ?>
</span></div><br/><hr/>
</td>
</tr>
<tr>
<td> </td>
</tr>
<? }
?>
<!-- news ends -->
Cheers
Lee
The code is below:
<?php
include "config.php";
session_start();
include("config.php");
$sid=session_id();
$date=date("Y-m-d");
$sql="select * from usr where sid='$sid' AND ddate='$date' AND pageno=14";
$q=mysql_query($sql) or die(mysql_error());
$c=mysql_num_rows($q);
$usrcnt=0;
if($c<1)
{
$q1=mysql_query("insert into usr(sid,ddate,pageno) values('$sid','$date',14)") or die (mysql_error());
$q3=mysql_query("select count(*) from usr where pageno=14") or die (mysql_query());
$r3=mysql_fetch_row($q3);
$usrcnt=$r3[0];
}
else
{
$q2=mysql_query("select count(*) from usr where pageno=14") or die (mysql_query());
$r2=mysql_fetch_row($q2);
$usrcnt=$r2[0];
}
?>
and here is code on the page:
<!-- news starts -->
<?
$qu=mysql_query("select * from tbl_news") or die (mysql_error());
while($r=mysql_fetch_assoc($qu))
{?>
<tr>
<td><div align="justify"><span class="thomsan">
<?= $r['Nom_New'] ?>
</span><span class="innerpagetext"><br/>
<?= $r['Desc_New'] ?>
</span></div><br/><hr/>
</td>
</tr>
<tr>
<td> </td>
</tr>
<? }
?>
<!-- news ends -->
Cheers
Lee