Hi All,
In my program i am running a while loop which will produce one row for every loop, Now if you see the table user(9754) is there multiple times. Now i want to make sure that it is taking only the last row and leaving all the duplicate entries.
The above code will produce the following output inside a tablePHP Code:
$query = mysql_query("select * from member where rank = '2'' ");
while($result = mysql_fetch_array($query))
{
$user = $result['code'];
$amount = $result['amount'];
echo "<tr><td> $user </td> <td> $amount </td> </tr>";
}
HTML Code:<table border="1" width="150" > <tr> <td> <td>User </td> <td>Amount</td></tr> <td>3206</td> <td>606</td> </tr> <td>9754</td> <td>60</td> </tr> <td>9754</td> <td>70</td> </tr> <td>9754</td> <td>140</td> </tr> <td>9754</td> <td>240</td> </tr> <td>2483</td> <td>350</td> </tr> </table>
I want this to be like below
HTML Code:<table border="1" width="150" > <tr> <td> <td>User </td> <td>Amount</td></tr> <td>3206</td> <td>606</td> </tr> <td>9754</td> <td>240</td> </tr> <td>2483</td> <td>350</td> </tr> </table>
Can anyone help me how to solve this issue.



Reply With Quote


Bookmarks