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
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?

Link to comment
Share on other sites

And what about running the same query directly in mysql?

 

If that works, you might want to post some of the code you cut out, cause there don't seem to be many errors in that code shown.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.