How to get tabels from database in php andd display it in
the table form using codelgniter?
plz help me

Answer Posted / vivek soni

//HTML coding
<html>
<head>
<title>Table</title>
</head>
<body>
<div><?php include("table.php");?></div>
</body>
</html>

//include table.php contain....
<?php
include("inc_connection.php");
$sql="select * from tablename";
$rs=mysql_query($sql);
echo "<table border=1 width='100%'> ";
echo "<tr><td colspan='2' align='center'>Student
Name</td><td >phone No</td></tr>";

while($row=mysql_fetch_assoc($rs))
{
echo "<tr><td align='right'>".$row['fname']."</td><td
align='left'>".$row['lname']."</td><td>".$row['phn']."</td></tr>";
}
echo "</table>";
?>

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is design pattern? Explain all including singleton pattern?

752


Tell me how is it possible to return a value from a function?

801


What is the difference between $argv and $argc? Give example?

713


How to find length of an array in php ?

781


List some string function name in php?

727


Explain briefly about a search-friendly site looks like?

707


Explain about switch statement in PHP?

802


How do I use isdigit function?

796


What is the function of mysql_real_escape_string in php?

700


What is the major php security hole? How to avoid?

771


What is the output of the following php code?

684


Explain how can php and javascript interact?

746


What function should you use to join array elements with a glue string?

767


How to join multiple strings into a single string?

734


What is a php 5?

758