I want to retrieve the data and display it on the basis of their position.
Also if you want to order by specific positions, you can use an expression:
$st="SELECT * FROM section WHERE report_id ='".$s[0]."' ORDER BY position>3 desc, position<=3 asc";
... Will first order anything greater than 3 in descending order
8
6
5
4
followed by anything less than or equal to 3 in ascending order.
1
2
3
Aside, sorry, slightly off topic . . .
Don't do this.
while ($kr<mysql_num_rows($res))
There's no need to count the rows and use a separate incrementor to know where you are at (unless you need that number for something, which in most cases, you don't.) The while loop will iterate the rows until it's done. Do this instead.
$res=mysql_query($st) or die('Error'.mysql_error());
while ($result=mysql_fetch_array($res)) {
echo "
<div align=\"center\">" .
$result['content'] .
</div>
";
}
Also if you're only expecting a single result, you can use "if" instead of "while". The output result will be the same, but "while" implies there may be multiple records.