Last active
December 22, 2015 01:59
-
-
Save umairidrees/6400387 to your computer and use it in GitHub Desktop.
just copy that table. and add database table name. and all data will be available for you on your page from database.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$username="root"; $password=""; $database="exam_codes"; | |
$con = mysql_connect("localhost",$username,$password) or die( "Unable to Connect database"); | |
mysql_select_db($database,$con) or die( "Unable to select database"); | |
$ShowTable = "blogs"; | |
$sql = mysql_query("SELECT * FROM `$ShowTable` LIMIT 11"); | |
$row = mysql_fetch_assoc($sql); | |
// show headings alon | |
echo "<table class='table table-striped'><tr><th>No</th>"; | |
foreach($row as $name => $value){ | |
echo '<th>'.$name.'</th>'; | |
} | |
echo "</tr>"; | |
// show all records without headings | |
while($row = mysql_fetch_assoc($sql)){ | |
echo "<tr>"; | |
foreach($row as $name => $value){ | |
echo '<td>'.$value.'</td>'; | |
} | |
echo "</tr>"; | |
} | |
echo "</table>"; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment