views:

43

answers:

1

Dear all, my code is below.it show the output in table format having no problems. But when the particular tr gets long output from database then the table break. Now how can i fixed the tr width strictly?let say i want each td cannot be more than 100px. How can i do it? Note: Here table means html table,not the database table.

            if ($query->num_rows() > 0) 

{ $output = ''; foreach ($query->result() as $function_info) { if ($description) {
$output .= ''.$function_info->songName.''; $output .= ''.$function_info->albumName.'';
$output .= ''.$function_info->artistName.''; $output .= ''.$function_info->Code1.''; $output .= ''.$function_info->Code2.''; $output .= ''.$function_info->Code3.''; $output .= ''.$function_info->Code4.''; $output .= ''.$function_info->Code5.'';
} else { $output .= ''.$function_info->songName.''; } } $output .= ''; return $output; }

else { return '

Result not found.

'; }

thanks riad

A: 

You can either do it in the HTML...

<td style="width: 100px">

Or you can try using wordwrap.

fire
Dear fire,thanks for your guidance.but code not worksEX: $output .= '<td style="width: 100px">'.$function_info->Code1.'</td>'; $output .= '<td style="width: 100px">'.$function_info->Code2.'</td>';I need ,whatever the result is but td width must be fixed as like as normal table.But in here td width compress or extends depend with result.I have to use code here,because its randomly pick the result from database.So,could you pls guide me what code i have to use here.I shall be happy if you guide me with example.Thanks in Advance,riad
riad