|
Posted by Kevin H. Feeley on 01/08/06 00:06
Leszek wrote:
> I want to get this:
>
> //Column1 Column2
> Room: return_data($wiersz2[0])
> Price: return_data($wiersz2[1])
> How many?: return_data($wiersz2[2])
>
> But using my code i'm getting:
>
> Room:
> Price:
> How many?:
> return_data($wiersz2[0])
> return_data($wiersz2[1])
> return_data($wiersz2[2])
>
> Pozdrawiam.
> Leszek
Two basic ways of handling this. One is a html solution, the other array
based.
HTML Solution:
Nested tables.
<table>
<tr>
<td>
<table><tr><td>Room:</td></tr><tr><td>Price</td></tr><tr><td>How
many?:</td></tr></table>
</td>
<td>
<table><tr><td>return_data($wiersz
[0])</td></tr><tr><td>return_data($wiersz
[1])</td></tr><tr><td>return_data($wiersz2[2])</td></tr></table>
</td>
</tr>
</table>
Array based:
/* Toss both sets of values (labels and data) into arrays */
$labels=array('Room:','Price:','How many?:');
$column[1]=array(return_data($wiersz2[0]),return_data($wiersz
[1]),return_data($wiersz2[3]));
$column[2]=array(return_data($ziersz2[0]),return_data($ziersz
[1]),return_data($ziersz2[2]));
echo("<table>");
for($i=0;$i<=(count($labels)-1);$i++){
echo("<tr><td>{$labels[$i]}</td>");
foreach($column AS $col){
<td>$col[$i]</td>
}
echo("</tr>");
}
echo("</table>");
Navigation:
[Reply to this message]
|