Hi I am just wondering if anybody can help me with this matter...... I have write a program that will display result contained in the database..... the program is successful but I don't like the way it display the result...... Therefore I am wondering is there anyway that I can do so that my result will be displayed as a table....... something that looks like a table with columns.....
This is what I have done so far.....
<?
$conn = odbc_connect("denggi", "" , "" );
if (!$conn)
{exit("Connection Failed: ".$conn);}
$query="SELECT * FROM msjp_sample";
$result=odbc_exec($conn,$query);
if(!$result)
{exit("Error in SQL");}
echo '<h3>MS Access Powered Database</h3>';
while(odbc_fetch_row($result))
{
$e_name=odbc_result($result,"NAMA");
$bulan=odbc_result($result,"BULAN");
$e_date=odbc_result($result,"ONSET");
echo '<b>Nama:</b>'.$e_name.'<br>';
echo '<b>Bulan</b>'.$bulan.'<br /> <b>Date:</b>'.$e_date.'<br />
<hr/>';
}
odbc_fetch_row($result);
odbc_close($conn);
?>
Need help in displaying result as a table.........
Moderator: General Moderators
Re: Need help in displaying result as a table.........
Code: Select all
$conn = odbc_connect("denggi", "" , "" );
if (!$conn){
exit("Connection Failed: ".$conn);
}
$query="SELECT * FROM msjp_sample";
$result=odbc_exec($conn,$query);
if(!$result){
exit("Error in SQL");
}
echo '<h3>MS Access Powered Database</h3>';
echo '<table><tr><th>NAMA</th><th>NULAN</th><th>DATE</th></tr>';
while(odbc_fetch_row($result)){
echo "<tr>";
echo "<td>" . odbc_result($result,"NAMA") . "</td>";
echo "<td>" . odbc_result($result,"BULAN"). "</td>";
echo "<td>" . odbc_result($result,"ONSET"). "</td>";
echo "</tr>";
}
echo "</table>";
odbc_fetch_row($result);
odbc_close($conn);
Last edited by John Cartwright on Thu Dec 03, 2009 3:21 am, edited 1 time in total.
Reason: please use [code=php][/code] tags
Reason: please use [code=php][/code] tags
Re: Need help in displaying result as a table.........
Thank you so much........................