i don't know if my subject meets my need here. hehe. i'm quiet new to this thing and done a 'hello world" so far. i wanted to sort a result by asc/desc when sort button is clicked. this is what i've got so far.
i don't know how to have the page knowing wether it's asc/desc sort of the result. any help would be greatly appreciated.PHP Code:<style>
body,table,input{
font:9pt arial;
}
td,th{
padding:3px;
}
th{
color:white;
}
</style>
<?php
mssql_connect("x","sa","password");
mssql_select_db("northwind");
echo"<input type=submit value='sort'><br><br>";
echo"<table cellspacing=1 bgcolor=#666699 width=100%>";
echo"<tr><th>ID</th><th>Description</th><th>Region</th></tr>";
load("select * from territories");
echo"</table><br>";
function load($s){
$result=mssql_query($s);
$i=0;
while($row=mssql_fetch_array($result,MSSQL_NUM)){
if($i%2==0) echo"<tr bgcolor=white>";
else echo"<tr bgcolor=#f4f4f4>";
foreach($row as $r) echo "<td>$r</td>";
echo"</tr>";
$i++;
}
}
?>




Reply With Quote