Jump to content

Display the child record on clicking the parent record from the database


viji123

Recommended Posts

Hi,

I am fetching a set of records from the database which is order by UserID. I would like to display the first record of each userID in row. On clicking on the userId I would like to display the other records of the respective userID. Can anybody please give me an idea for this?

Regards,

Viji

Link to comment
Share on other sites

What do you need other than what you've already said?

 

SELECT userId, MAX(field_you_order_records_by), some, other, fields FROM theTable GROUP BY userId

Display that, with a link to a page that will:

"SELECT * FROM theTable where userId = " . mysql_real_escape_string( $_GET['userId'] )

-Dan

Link to comment
Share on other sites

Hi,

Thank you very much for your queries. Other than these queries , I would like to display the records of the second query in <tr></tr> when I click on the corresponding record resulting from the first query in a  <tr><tr>. Can you please suggest me an idea for this?

Regards,

Viji

Link to comment
Share on other sites

Then do that.  We're not going to write your code line by line.  If you don't know how to output the results of a mysql query, you can:

1)  Copy and paste the example from the PHP manual page for mysql_query

2)  Hire someone to do it.

3)  Stop this project, learn php, then come back when you know how.

 

-Dan

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.