Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> MySQL
Author Message
netgoodies
Regular
Regular



Joined: Sep 26, 2005
Posts: 63
Location: Oxfordshire. United Kingdom.

PostPosted: Mon Nov 07, 2005 11:19 am Reply with quote

Hi I cannot seem to sort the problem out from this code I have written for a block.

The problem is the sort order.

I get 1, 10, 2, 3, 4, 5, 6, 7, 8, 9

I want: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10

Code:
if ( !defined('BLOCK_FILE') ) {

    Header("Location: ../index.php");
    die();
}

global $prefix, $dbi;
$a = 1;
$result = sql_query("SELECT tipid, title, tipster, ratings FROM ".$prefix."_tips ORDER BY ratings DESC LIMIT 0,10", $dbi);
      while(list($tipid, $thetitle, $thetipster, $theratings) = sql_fetch_row($result, $dbi)) {
$content .= "<strong><big>&middot;</big></strong>&nbsp;$a <a href=\"modules.php?name=Tips&amp;
      func=TipView&amp;tipid=$tipid\">$thetitle</a>";
$content .="<br>\n";
$content .= "<font color=\"#666666\"><i>&nbsp;&nbsp;Tipster $thetipster</i></font>";
$content .="<br>\n";
$content .= "<font color=\"#666666\">&nbsp;&nbsp;Rated $theratings</font><br>";
$a++;
}
$content .="<hr>\n";
$content .="<br><center><a href=\"modules.php?name=Tips\"STYLE=\"text-decoration: none\">
      <b>Tips</b></a></center>";
?>


I've read somewhere (I think, because it was some time ago) the problem is down to having to convert the output to an integer by placing a "+0" by can't see where to place it!

Help please.

Regards
Martyn.
 
View user's profile Send private message Visit poster's website
Raven
Site Admin/Owner



Joined: Aug 27, 2002
Posts: 17088

PostPosted: Mon Nov 07, 2005 11:36 am Reply with quote

No, that's not the problem. Make sure that ratings is defined as an Integer of some kind.
 
View user's profile Send private message
netgoodies







PostPosted: Mon Nov 07, 2005 3:01 pm Reply with quote

Sorted...... thanks raven.
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> MySQL

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©