lovephp Posted February 26, 2014 Share Posted February 26, 2014 friend i am trying to display the data like this company Names Phone Numbers some name 1 number 1 number 2 number 3 number 4 some name 2 number 1 number 2 number 3 number 4 some name 3 number 1 number 2 number 3 number 4 echo '<table align="center" width="500" border="1">'; echo '<tr>'; echo '<th scope="col">Company Names</th>'; echo '<th scope="col">Transfer Numbers</th>'; echo '</tr>'; $data1=mysql_query("select cat_id, category from company_names"); while($info1=mysql_fetch_array($data1)) { $id = $info1[0]; $comp = $info1[1]; echo '<tr>'; echo "<td><font size='4' color='#FF3300'>".$comp."</font> <a href ='del-comp.php?id=$id'><img src='del.jpg' alt='Delete' height='13' width='13' title='Delete'></a><br/></td>"; $data2=mysql_query("select cat_id, subcategory from company_numbers where cat_id=' $id '"); while($info2=mysql_fetch_array($data2)) { $cat_id = $info2['0']; $nums = $info2['1']; echo "<td><font size='2' color='blue'>".$nums."</font> <a href ='del-num.php?id=$id&num=$nums'><img src='del.jpg' alt='Delete' height='8' width='8' title='Delete'></a></td>"; echo '</tr>'; } } echo '</table>'; but it does not show like i want it could someone help? Link to comment https://forums.phpfreaks.com/topic/286551-help-displaying-data-accordingle-in-table/ Share on other sites More sharing options...
ginerjm Posted February 26, 2014 Share Posted February 26, 2014 Your nums are showing up in the first column aren't they? Add a "<td> </td>" in front of the td for the num Link to comment https://forums.phpfreaks.com/topic/286551-help-displaying-data-accordingle-in-table/#findComment-1470792 Share on other sites More sharing options...
lovephp Posted February 26, 2014 Author Share Posted February 26, 2014 i dont know its all messup it still would not show the results like i want it to sob Link to comment https://forums.phpfreaks.com/topic/286551-help-displaying-data-accordingle-in-table/#findComment-1470795 Share on other sites More sharing options...
ginerjm Posted February 26, 2014 Share Posted February 26, 2014 Get rid of the extra stuff like the <a> tags and the <font> tags and make this just about doing your query and displaying those results. Once that is working you can add the pretty stuff later. Oh - and show the code once you make those changes. Link to comment https://forums.phpfreaks.com/topic/286551-help-displaying-data-accordingle-in-table/#findComment-1470796 Share on other sites More sharing options...
lovephp Posted February 26, 2014 Author Share Posted February 26, 2014 got it mate at last thanks alot \m/ Link to comment https://forums.phpfreaks.com/topic/286551-help-displaying-data-accordingle-in-table/#findComment-1470798 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.