Dear Guys,

i have Created a Table using Php and when i inters much data on it (Address or History of some subjects), it will make the table toooo large in size which's unneeded .. i need to manage the width of my table eeven if i enter lots of data on it i want it to be line by line not to resize my table and makes it ugly and missed up.


mch luvv
an intern

Recommended Answers

All 5 Replies

I think you are talking about HTML table.
You can fix the width of table.
You need to post your code for review.
PLEASE USE CODE TAGS.

<table width=500px>
<tr>
<td width=10%>1 </td>
<td width=40%>2 </td>
<td width=40%>3 </td>
</tr>

<tr>
<td >4 </td>
<td >5 </td>
<td >6 </td>
</tr>

<tr>
<td >7 </td>
<td >8 </td>
<td >9 </td>
</tr>
</table>

echo "<tr><td width=300><b>&nbsp;&nbsp;Cotegory</b></td><td >&nbsp;&nbsp;" .  $row [0] ."</td></tr>"."<tr><td><b>&nbsp;&nbsp;Company name</b></td><td >&nbsp;&nbsp;" .  $row [1] ."</td></tr>"."<tr><td><b>&nbsp;&nbsp;CEO</b></td><td >&nbsp;&nbsp;" .  $row [2] ."</td></tr>"."<tr><td><b>&nbsp;&nbsp;Public Relations</b></td><td >&nbsp;&nbsp;" .  $row [3] ."</td></tr>"."<tr><td><b>&nbsp;&nbsp;Ownership</b></td><td >&nbsp;&nbsp;" .  $row [4] ."</td></tr>"."<tr><td><b>&nbsp;&nbsp;Field of Operation </b></td><td >&nbsp;&nbsp;" .  $row [5] ."</td></tr>"."<tr><td><b>&nbsp;&nbsp; Budget Of CSR </b></td><td >&nbsp;&nbsp;" .  $row [6] ."</td></tr>"."<tr><td><b>&nbsp;&nbsp;Portable Awards</b></td><td >&nbsp;&nbsp;" .  $row [7] ."</td></tr>"."<tr><td><b>&nbsp;&nbsp;Countries of Operation</b></td><td  >&nbsp;&nbsp;" .  $row [8] ."</td></tr>"."<tr><td><b>&nbsp;&nbsp; History  Of Donation in Health Care </b></td><td >&nbsp;&nbsp;" .  $row [9] ."</td></tr>"."<tr><td><b>&nbsp;&nbsp;Year of Operation </b></td><td >&nbsp;&nbsp;" .  $row [10] ."</td></tr>"."<tr><td><b>&nbsp;&nbsp;Realtionship With WHO </b></td><td >&nbsp;&nbsp;" .  $row [11] ."</td></tr>"."<tr><td><b>&nbsp;&nbsp;Relationship With Universities </b></td><td >&nbsp;&nbsp;" .  $row [12] ."</td></tr>"."<tr><td><b>&nbsp;&nbsp;Realtionship With Charitable Organizations </b></td><td >&nbsp;&nbsp;" .  $row [13] ."</td></tr>"."<tr><td><b>&nbsp;&nbsp; Telephone No  </b></td><td >&nbsp;&nbsp;" .  $row [14] ."</td></tr>"."<tr><td><b>&nbsp;&nbsp; Fax No </b></td><td >&nbsp;&nbsp;" .  $row [15] ."</td></tr>"."<tr><td><b>&nbsp;&nbsp; Email Address  </b></td><td >&nbsp;&nbsp;" .  $row [16] ."</td></tr>"."<tr><td><b>&nbsp;&nbsp; Postal Address </b></td><td >&nbsp;&nbsp;" .  $row [17] ."</td></tr>";



  echo "</tr>";
  }

echo "</table>";

// the data wil be out from the database and fill up the space front of Address ... and History then if the information are too much words the table wil got right side but what's i want is the data can be within the table in more than 1 line better than what's going on now.
i know u all got what i mean !
// the space of history and postal address is where i want it not to be resized when i enter data into it .. any idea ?

<tr><td><b>&nbsp;&nbsp; History  Of Donation in Health Care </b></td><td width=300px>&nbsp;&nbsp;" .  $row [9] ."</td></tr>

<tr><td><b>&nbsp;&nbsp; Postal Address </b></td><td width=300px>&nbsp;&nbsp;" .  $row [17] ."</td></tr>

I have written <td width=300px> in value part (2nd column of table). So maximum column width will be 300. do not set width in another row values. You may adjust width according to your data string length of history or postal which ever is bigger

commented: MY DEAR I DON"T KNOW HOW TO THANK U !! I LOVE U MAN :) :) it works out +1

Make sure you set all the width tags to be correct.
else you can use styles
td {
width:300px;
}

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.