Ritika Posted March 9, 2016 Share Posted March 9, 2016 (edited) PLEASE help................ // I am getting output like /* * Date |NAME | Roll_no | ATTEND ======================================== 01/02/14 |Musician | 1 | 1 01/02/14 |Leader | 2 | 1 01/02/14 |Singer | 3 | 0 08/02/14 |Musician | 4 | 0 08/02/14 |Leader | 5 | 1 08/02/14 |Singer | 6 | 1 * */ /* NEEDED sample output: * * Roll_no | NAME |01/02/14 |08/02/14 =============================== 1 |Musician | 0 | 1 2 |Leader | 1 | 1 3 | Singer | 1 | 0 */ here is my code -- { <?php include('config.php'); $sql = ("SELECT roll_no,attend,date from atten ") ; $q1 = mysql_query($sql) or die("could not search!"); echo "<table border='1'>"; echo "<tr> <td>roll_no </td> <td> attendance</td> <td> Date </td> </tr>" ; while ($row=mysql_fetch_array($q1)) { echo "<tr> <td>". $row['roll_no'] ." </td> <td>". $row['attend'] ." </td> <td>". $row['date'] ." </td> </tr>"; } echo "</table>"; ?> } Edited March 9, 2016 by Ritika Quote Link to comment https://forums.phpfreaks.com/topic/300960-pivot-table/ Share on other sites More sharing options...
samuel_lopez Posted March 11, 2016 Share Posted March 11, 2016 You should group your query by name Quote Link to comment https://forums.phpfreaks.com/topic/300960-pivot-table/#findComment-1531907 Share on other sites More sharing options...
Ritika Posted March 11, 2016 Author Share Posted March 11, 2016 I want to do it with PHP .. thanks Quote Link to comment https://forums.phpfreaks.com/topic/300960-pivot-table/#findComment-1531908 Share on other sites More sharing options...
ginerjm Posted March 11, 2016 Share Posted March 11, 2016 Funny post. You show us one set of data and then show us code that doesn't match it. Confusing. Quote Link to comment https://forums.phpfreaks.com/topic/300960-pivot-table/#findComment-1531920 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.