Jump to content

Help displaying data accordingle in table


lovephp

Recommended Posts

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?

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.