Jump to content

Help displaying data accordingle in table


lovephp
Go to solution Solved by 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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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