Hi,

I wants to display my results on the browser.

Table1 Table2
sno name sno name
1 sss 3 kkk
2 aaa 4 xxx


I need the tables on both side. How can i do this ? Thanks

Do you have a mysql database which you use?
What results you want to display?

Normally with PHP you generate html code which is writable for browsers.
So its easy to create the tables with storing html code into variable as this:

$somehtmlvar="<table><tr><td>AAAA</td></tr></table>";
echo $somehtmlvar;

To give you better solution provide us with info about where you get your data from: mysql, xml, or you enter it manual.

hi,
i can't understand. Normally, how we can place tables side by side on the web page. I dont need to display my table sequentially. Please help me out.

Why do you want two separate table?
You can have only one table and use number of TD you want.
Make loop proper for closing each TD & TR.

Or maybe try:
<div style="float: left; width: 50%;">
<table>....
</div>
<div style=float: left; width: 50%;">
<table>....
</div>

"i can't understand. Normally, how we can place tables side by side on the web page. I dont need to display my table sequentially. Please help me out. "
you don't need to display your data sequentially, is that what you mean?
is your data in an array, how is your data getting to the web page?

$rows = some result set of a query i assume;
<html>
<table>
<?php
// fake the data
$cap=array();
for ($s=0;$s<21;$s++) {
     array_push($cap,'caption-'.$s);
}
echo "<table>";
$i=0;
foreach ($cap as $c) {
     $caption = $c;
     if ($caption != '') {
	$i++;
        if ($i % 2) {
	    //echo "i % 2 = " . $i . "<BR>";
	    echo "<tr>";
	} else {
	    // do nothing
	}
	echo "<td style=\"border-bottom: 0px solid white;\">$caption</td>";
	if ($i % 2) {
	    // do nothing
	} else {								
	     echo "</tr>";
	}			
    }
}		
?>
</table>

hi thanks for your code. But i can't understand your code what you posted.

I am having an array with the number of values 85. I want to display this 85 values in the browser with html table format.

My need is, i want to divide this 85 values into half(array values into half -> 43 and 42). I want first 43 number of values to be displayed on left side of my web page(in table format) and the remaining 42 values to be displayed on right side of my web page(with same table format).

I don't need total array values(total number of array values->85) to be printed sequentially (continuously) on my web page. Did you understand. thanks. please help me out.

Do you need them to be ordered (in left from 1 to 43, in right 44-87) or they can be 1st in left, 2nd in right,
3rd in left, 4th in right...
etc..

hi...1 to 43 in left and 44 to 85 in right (array to be splited equally). splitted array to be printed in browser(with html table format) left and right. Did you understood ?

don't need 1st left, 2nd right, 3rd left......

$html="<table><tr><td>
<table>";
$array=array();
$i=43; $c=0;
foreach($array as $key=>$val){
	$c=$c+1; if($c==$i) $html.="</table></td><td><table>";
	$html.="<tr><td>".$val."</td></tr>";	
	}
$html.="</table></td></tr></table>";

This is what you need :)
at the end only add one ECHO $html; to display the results.
$array is your array there must be set your entries.

hi most thanks for you...this is i want.

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.