Tuesday, 13 May 2014

Fetch or Display data from database in PHP&MySql

Posted by D. arunkumar  |  No comments

 <style type="text/css">  
 #t1 {  
      background:#8AD8F4;  
      margin:7% 33% 33% 39%;  
 </style>  
 <?php  
 $conn=mysql_connect("localhost","root","");  
 mysql_select_db("mytest",$conn);  
 $sql="select * from list";  
 $res=mysql_query($sql);  
 ?>  
 <div id="t1">  
 <table align="center" border="1">  
 <tr><th>Sno</th><th>Name</th><th>Email</th><th>Gender</th><th>Location</th></tr>  
 <?php while($results=mysql_fetch_array($res)) { ?>  
 <tr>  
 <td><span style="color:red"><?php echo $results['sno']; ?></span></td>  
 <td><?php echo $results['name']; ?></td>  
 <td><?php echo $results['email']; ?></td>  
 <td><?php echo $results['gender']; ?></td>  
 <td><?php echo $results['location']; ?></td>  
 </tr>  
 <?php } ?>  
 </table>  
 </div>  
Data:

01:49 Share:

0 comments:

Get updates in your email box
Complete the form below, and we'll send you the best coupons.

Deliver via FeedBurner
Proudly Powered by Blogger.
back to top