Page 1 of 1
Sorting by number
Posted: Tue Jun 25, 2002 4:40 pm
by Russ
If I wanted to sortby a number, not just the number 1, but all the numbers, how would I do that? action=sortby&char=num ? action=sortby&char=number? action=sortby&char=1,2,3,4,5,6,7,8,9,0?
Posted: Wed Jun 26, 2002 1:45 am
by twigletmac
I'm assuming you have a program that someone else has written which you are trying to edit because things like action=sortby&char=num mean nothing to PHP. Could you explain a bit better what you are trying to achieve please and perhaps paste some of the code that you are trying to do it with.
Mac
Posted: Wed Jun 26, 2002 1:28 pm
by Russ
heres my code, basicly I can sort it by various letters, but numbes, but not just the ones that begin with 1 but all the numbers,
Code: Select all
if($_GETї'action'] == 'sortby')
{
$result = mysql_query("select * FROM interdb WHERE bandname LIKE '".strtoupper($_GETї'char'])."%' ORDER BY bandname ASC LIMIT 5",$db);
while($myrow = mysql_fetch_array($result))
{
echo ( "<p><b><a href=?action=view&id=" .$myrowїid]. " class=link>" . $myrowї'bandname'] . "</a></b> <font class=rm>- " . date("F j", strtotime($myrowї'date'])) . "</font>" );
echo ( "<br>" . $myrowї'preinter'] );
echo ( "<br><b><font class=rm><a href=?action=view&id=" .$myrowїid]. " class=rm>...Read More</a></b></font>" );
}
}
elseif($_GETї'action'] == 'view')
{
$result = mysql_query("SELECT * FROM interdb WHERE id=$id",$db);
$myrow = mysql_fetch_array($result);
{
echo( "<br><b>" . $myrowї'bandname'] . " Interview</b>" );
echo( "<p>" . $myrowї'preinter'] );
echo( "<p>" . $myrowї'inter'] );
}
}
else
{
$result = mysql_query("SELECT * FROM interdb ORDER BY id desc LIMIT 5",$db);
while($myrow = mysql_fetch_array($result))
{
echo( "<p><b><a href=?action=view&id=" .$myrowїid]. " class=link>" . $myrowї'bandname'] . "</a></b> <font class=rm>- " . date("F j", strtotime($myrowї'date'])) . "</font>" );
echo( "<br>" . $myrowї'preinter'] );
echo( "<br><b><font class=rm><a href=?action=view&id=" .$myrowїid]. " class=rm>...Read More</a></b></font>" );
}
}