Jump to content

Display all results with the same id?


livewirerules

Recommended Posts

Im am trying to retrieve all the transaction information that is done by user. Below is my code

 

$sql="select * from trans where tfid='987456'";
$result=mysql_query($sql) or die(mysql_error());

while ($row=mysql_fetch_array($result)) {
    $date=$row['h_date'];
    $ref=$row['ref'];
    price=$row['price'];

echo"<tr>
    <td>$date</td>
    <td>$ref</td>
    <td>$price</td>
  </tr>";

 

I have around 6 transactions with the same tfid. but in the above code it shows only the first result.. how do i show all the 6 transactions?

 

thanks

Link to comment
https://forums.phpfreaks.com/topic/204252-display-all-results-with-the-same-id/
Share on other sites

Well, that code would not compile (missing } for while loop), but it looks like it would display all results, and the SQL seems to get all the transactions with that tfid.

 

Can you double check by running the same query right inside mysql?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.