Ok, the site is supposed to get these tutorials and display them in a list. The only problem is that it is not putting the tutorials(they get a number each time they send them in, like 1, 2, or 3) arent being put in the numerical order. Instead the ones that have avatars are put first, then the ones that arent are. I would like to have it where it is put in order from 1-500. What am i doing wrong:
<?php
$query = "SELECT id, autor, description, date, url, title, avatar, hitsout
FROM drawing_accepted order by id DESC";
$result = mysql_query($query);
$totalrows = mysql_num_rows($result);
$page = $_GET['num'];
if(!IsSet($page))
$page = 1;
if($_GET['results_returned'] == "")
$limit = 10;
else
$limit = $_GET['results_returned'];
list 1-5000
$limitvalue = $page * $limit - ($limit);
if($_GET['numlinks_perpage'] == "")
$max_links_shown = 3;
else
$max_links_shown = $_GET['numlinks_perpage'];
$query = $query." LIMIT $limitvalue, $limit";
$result = mysql_query($query) or die(mysql_error());
if(mysql_num_rows($result) == 0)
echo 'No results returned.';
else
{
?>
<div id="bwrap">
<div class="style1" id="title">Beginner Modding Tutorials</div>
<div id="bar"><? echo "<font color=\"#779a5e\">".$totalrows." Tutorials: </font>"; ?></div>
<div id="content">
<?
$numofpages = ceil($totalrows / $limit);
if($numofpages > 1)
{
if($max_links_shown >= $numofpages)
{
for($i = 1; $i <= $numofpages; $i++)
{
if($i == $page)
echo "[$i]";
else
echo(" <a href=\"tutorials.php?cat=adobephotoshop&subcat=drawing&num=$i?\">$i</a> ");
}
}
else
{
if($max_links_shown%2 != 0)
{
$first_page_link = $page - (($max_links_shown - 1)/2);
$last_page_link = $page + (($max_links_shown - 1)/2);
}
else
{
$first_page_link = $page -($max_links_shown/2) + 1;
$last_page_link = $page + ($max_links_shown/2);
}
if($first_page_link < 1)
{
for($i = $first_page_link; $i < 1; $i++)
$last_page_link++;
$first_page_link = 1;
}
if($last_page_link > $numofpages)
{
for($i = $last_page_link; $i > $numofpages; $i--)
$first_page_link--;
$last_page_link = $numofpages;
}
if($first_page_link != 1)
echo("tutorials.php?cat=adobephotoshop&subcat=drawing&?num=1?".
$varstring."\">First</a> ... ");
for($i = $first_page_link; $i <= $last_page_link; $i++)
{
if($i == $page)
echo "<font color=\"#779a5e\">[$i]</font>";
else
echo("<a href=\"tutorials.php?cat=adobephotoshop&subcat=drawing&?num=$i?".
$varstring."\">$i</a> ");
}
if($last_page_link != $numofpages)
echo("... <a href=\"tutorials.php?cat=adobephotoshop&subcat=drawing&?num=$numofpages?".
$varstring."\">Last</a> ");
}
}
echo '
';
$color1 = "#000000";
$color2 = "#FFFFFF";
$row_count = 0;
while($row = mysql_fetch_array($result)){
$row_class = ($row_count % 2) ? $color1 : $color2;
echo"
<table width=250 border=0>
<tr>
<td width=32><img src=$row[avatar] alt=$row[title] title=$row[description]></td>
<td width=458><p><a href=/track-adobephotoshop-drawing-$row[id].htm target=_blank title=$row[description]>$row[title] </a><br>
$row[date] by <strong>$row[autor] </strong><br>
$row[description]
<table width=100% border=0 cellspacing=0 cellpadding=0>
<tr>
<td>Clicks: $row[hitsout]</td>
<td><a href=/report-adobephotoshop-drawing-$row[id].htm target=_blank title=$row[description]>Report Bad Tutorial </a></td>
</tr>
</table>
"; ?><? echo"
</td>
</tr>
</table>
";
?><div id="bar"></div><?
$row_count++;
}
}
$numofpages = ceil($totalrows / $limit);
if($numofpages > 1)
{
if($max_links_shown >= $numofpages)
{
for($i = 1; $i <= $numofpages; $i++)
{
if($i == $page)
echo "[$i]";
else
echo("<a href=\"tutorials.php?cat=adobephotoshop&subcat=drawing&num=$i?\">$i</a> ");
}
}
else
{
if($max_links_shown%2 != 0)
{
$first_page_link = $page - (($max_links_shown - 1)/2);
$last_page_link = $page + (($max_links_shown - 1)/2);
}
else
{
$first_page_link = $page -($max_links_shown/2) + 1;
$last_page_link = $page + ($max_links_shown/2);
}
if($first_page_link < 1)
{
for($i = $first_page_link; $i < 1; $i++)
$last_page_link++;
$first_page_link = 1;
}
if($last_page_link > $numofpages)
{
for($i = $last_page_link; $i > $numofpages; $i--)
$first_page_link--;
$last_page_link = $numofpages;
}
if($first_page_link != 1)
echo("tutorials.php?cat=adobephotoshop&subcat=drawing&?num=1?".
$varstring."\">First</a> ... ");
for($i = $first_page_link; $i <= $last_page_link; $i++)
{
if($i == $page)
echo "<font color=\"#779a5e\">[$i]</font>";
else
echo("<a href=\"tutorials.php?cat=adobephotoshop&subcat=drawing&?num=$i?".
$varstring."\">$i</a> ");
}
if($last_page_link != $numofpages)
echo("... <a href=\"tutorials.php?cat=adobephotoshop&subcat=drawing&?num=$numofpages?".
$varstring."\">Last</a> ");
}
}
echo '
';
?>