viji123 Posted February 25, 2011 Share Posted February 25, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/228799-display-the-child-record-on-clicking-the-parent-record-from-the-database/ Share on other sites More sharing options...
ManiacDan Posted February 25, 2011 Share Posted February 25, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/228799-display-the-child-record-on-clicking-the-parent-record-from-the-database/#findComment-1179519 Share on other sites More sharing options...
viji123 Posted February 25, 2011 Author Share Posted February 25, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/228799-display-the-child-record-on-clicking-the-parent-record-from-the-database/#findComment-1179544 Share on other sites More sharing options...
ManiacDan Posted February 25, 2011 Share Posted February 25, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/228799-display-the-child-record-on-clicking-the-parent-record-from-the-database/#findComment-1179634 Share on other sites More sharing options...
viji123 Posted February 25, 2011 Author Share Posted February 25, 2011 Thank you very much. Quote Link to comment https://forums.phpfreaks.com/topic/228799-display-the-child-record-on-clicking-the-parent-record-from-the-database/#findComment-1179701 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.