Order by and row number

hi,Please i have been trying to include a row number that increases for each new row, and also make the list show by arranging the result of the query by the shop name but hitting brick wall:confused:.

this is the code

    <th>ROW NO</th>
    <th>SHOP NAME</th>
    <th>PRODUCT NAME</th>
    <th>PRODUCT SIZE</th>
    <th>PRODUCT COLOUR</th>
    // Get DB results and loop, outputting table rows with counter
    $pplresult = mysql_query("SELECT * FROM repplac WHERE Uname = '{$_SESSION['username']}'") or die(mysql_error());
   for ($i = 0; $row = mysql_fetch_assoc($pplresult); $i++) {
    echo "
    <input type='text' name='item[$i][Pquantity]' id='Pquantity' value='".htmlspecialchars($row['Pquantity'])."' />
    <input type='hidden' name='item[$i][Pidno]' id='Pidno' value='".htmlspecialchars($row['Pidno'])."' />
    <input type='text' name='item[$i][Price]' id='Pquantity' value='".htmlspecialchars($row['Price'])."' readonly>
    <td><a href='deleteproduct.php?del=".htmlspecialchars($row['Pidno'])."'>delete</a></td>

any suggestions or guide will be appreciated

applying a row number can be done very easily with php

sorting by shop name requires an ORDER BY clause in your SELECT statement

i have sorted the “order by”,statement, but applying the row numbers is not yielding, closest articles or forums am seeing re using sql functions like “@row := @row + 1” and its not working.

i have sorted it thanks for the guidance