Jump to content

bhrmalik

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Everything posted by bhrmalik

  1. Thanks kickstart it is almost what I was fetching for. But I need one more query I will post another post for that. As for this query it is solved. I had asked in Stack Overflow and another sites also but got the solution in here, by you kickstart. Thank you once again. Thanks you very much.
  2. table tution institute | teacher | subject | students -------------------------------------------- institute1 | john | maths | mary institute1 | john | maths | stacy institute2 | john | maths | david institute2 | john | science | bruce institute1 | tim | maths | steve institute2 | tim | science | harry institute1 | john | science | peter each teacher in each subject should have limited students, suppose 25 students should be present for each subject in class. So, here I want to write a single sql query to fetch the details of each teacher in a searched institute and their subject strength where institute is equal to searched institue. which show only that teacher details which is not having strength of 25 students in each subject where institue is equal to searched institute. I able to fetch the data but it will takes two queries and some php functions to get the result. first getting the rows of searched institute and then after with the values of institute and with foreach loop and another count sql query built in php function i am creating an array with count values, but the problem is i am getting the result in an array two different arrays as institute teacher list and teacher count and then after i had to do a lot of work like merge and sort. So, that's why i am here to take some guidance from experts to resolve my problem. I want to write a simple complete sql solution for this. Hope someone here will help me out to get the result. Thanks in Advance.
  3. Hello, I need some help in retrieve and display data from MySQL table where, I had a table name “employees” contents : --------------------------------------------------------- id|emp_name|report_to --------------------------------------------------------- 01|Scott|00 02|John|01 03|Martin|01 04|Smith|02 05|Sam|00 06|Henry|02 --------------------------------------------------------- "00" report_to should be report direct/null. One more thing is it possible to display the ID with leading zero. If I want to see the "01" the display should be. --------------------------------------------------------- MID|Manager|TLID|TeamLeader|EmpID|Employees --------------------------------------------------------- 01|Scott|02|John|04|Smith 01|Scott|02|John|06|Henry 01|Scott|03|Martin|--|------ If I want to see the "02" the display should be. --------------------------------------------------------- TLID|TeamLeader|EmpID|Employees --------------------------------------------------------- 02|John|04|Smith 02|John|06|Henry --------------------------------------------------------- I am using the this code in php : PHP CODE : $sql="select t1.id, t1.emp_name from employees as t1 where report_to='$_POST[text]' "; $data=mysql_query($sql) or die(mysql_error()); echo "<table border='2'>"; while ($rec=mysql_fetch_row($data)) echo "<tr><td>$rec[0]</td><td>$rec[1]</td></tr>"; echo " </table>"; ?> <br /> <form method="post" action=""> Username:<input type="text" name="text" /> <input type="submit" value="Submit" /> </form> --------------------------------------- Hope to meet some expert here Who will guide me to the right direction. Any help will be appreciated. Thanks in advance
  4. Hello, I need some help in retrieve and display data from MySQL table where, I had a table name “employees” contents : --------------------------------------------------------- id|emp_name|report_to --------------------------------------------------------- 01|Scott|00 02|John|01 03|Martin|01 04|Smith|02 05|Sam|00 06|Henry|02 --------------------------------------------------------- "00" report_to should be report direct/null. One more thing is it possible to display the ID with leading zero. If I want to see the "01" the display should be. --------------------------------------------------------- MID|Manager|TLID|TeamLeader|EmpID|Employees --------------------------------------------------------- 01|Scott|02}John|04|Smith 01|Scott|02|John|06|Henry 01|Scott|03|Martin|--|------ If I want to see the "02" the display should be. --------------------------------------------------------- TLID|TeamLeader|EmpID|Employees --------------------------------------------------------- 02|John|04|Smith 02|John|06|Henry --------------------------------------------------------- I am using the this code in php : PHP CODE : $sql="select t1.id, t1.emp_name from employees as t1 where report_to='$_POST[text]' "; $data=mysql_query($sql) or die(mysql_error()); echo "<table border='2'>"; while ($rec=mysql_fetch_row($data)) echo "<tr><td>$rec[0]</td><td>$rec[1]</td></tr>"; echo " </table>"; ?> <br /> <form method="post" action=""> Username:<input type="text" name="text" /> <input type="submit" value="Submit" /> </form> Hope to meet some expert here Any help will be appreciated. Thanks in advance
×
×
  • 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.