ascending/descending<

liunx

Guest
ok, i have this "shoutbox" thing at <!-- m --><a class="postlink" href="http://24.238.145.68/public/tagit2.php">http://24.238.145.68/public/tagit2.php</a><!-- m -->

the script:

<html>
<?
$mysql_server = "localhost";
$mysql_user = "morrowasted";
$mysql_password = "****";
$server = "localhost";
$query = "INSERT INTO shoutz VALUES('{$_GET['shout']}')";
$result = mysql_connect ($mysql_server, $mysql_user, $mysql_password);
mysql_select_db ("www");
mysql_query($query, $result);
mysql_close($result);



?>
</html>

<html>
<?
$mysql_server = "localhost";
$mysql_user = "morrowasted";
$mysql_password = "****";
$server = "localhost";
$query = "SELECT * FROM shoutz";
$result = mysql_connect ($mysql_server, $mysql_user, $mysql_password);
mysql_select_db ("www");
$result2=mysql_query ($query, $result);
$num=mysql_numrows($result2);
mysql_close($result);
$i=0;
while ($i < $num) {

$shouts=mysql_result($result2,$i,"shout");
echo $shouts;
echo "<br>";
$i++;
}

?>

<form action="tagit.php" method="get">
<input type="text" name="shout"><br>
<input type="submit" value="shout it foo!">
</html>

they appear with the most recent posts at the bottom... how can i switch this around?"SELECT * FROM shoutz order by blablabla desc";huh?

what do i put where is says blabla???

i have this:

<html>
<?
$mysql_server = "localhost";
$mysql_user = "*****";
$mysql_password = "******";
$server = "localhost";
$query = "SELECT * FROM shoutz";
$result = mysql_connect ($mysql_server, $mysql_user, $mysql_password);
mysql_select_db ("www");
$result2=mysql_query ($query, $result);
$num=mysql_numrows($result2);
mysql_close($result);
$i=$num;
if ($i > 0) {
while ($i <= $num) {

$shouts=mysql_result($result2,$i,"shout");
echo $shouts;
echo "<br>";
$i--;
}
}

?>

<form action="tagit.php" method="get">
<input type="text" name="shout"><br>
<input type="submit" value="shout it foo!">
</html>

which works, but it attempts to display negative rows, even with the if() statement....Originally posted by Gregory
huh?

what do i put where is says blabla???

i have this:


the blabla stuff can be any field in your shoutz table, generally the id field is what you want.ok williamoose fixed it for me :D

<html>
<?
$mysql_server = "localhost";
$mysql_user = "morrowasted";
$mysql_password = "******";
$server = "localhost";
$query = "SELECT * FROM shoutz ORDER BY id DESC";
$result = mysql_connect ($mysql_server, $mysql_user, $mysql_password);
mysql_select_db ("www");
$result2=mysql_query($query);
while($row = mysql_fetch_array($result2))
{
echo ''.$row["shout"].'<br>';

}

?>

<form action="tagit.php" method="get">
<input type="text" name="shout"><br>
<input type="submit" value="shout it foo!">
</html>Sorry Gregory, meant to further elaborate on the "blablabla", must have forgotten, glad that you got your help.
 
Back
Top