Bootstrap Demo
Bootstrap Code
Output
A demo to load data from MysQL DB in Bootstrap Tab by $.post
Home
Reviews
Features
Products
Write something for home tab
Reviews Tab / Add reviews here
Present features here
Load Products Data
The PHP code
< ?php //Remove space in PHP tag $dbhostname = 'localhost'; $dbusername = 'userid'; $dbpassword = 'password'; $conn = mysql_connect($dbhostname, $dbusername, $dbpassword); if(! $conn ) { die('Could not connect: ' . mysql_error()); } echo 'MySQL Database Connected!'."
"; mysql_select_db("testDB") or die(mysql_error()); echo "Database found and connected!"."
"; $sql_statemanet = "select * from tbl_products"; $rec_select = mysql_query( $sql_statemanet); if(! $rec_select ) { die('Could not retrieve data: ' . mysql_error()); } //Displaying fetched records to HTML table echo "
"; echo "
ID
Product
Quality
Quantity
"; // Using mysql_fetch_array() to get the next row until end of table rows while($row = mysql_fetch_array( $rec_select )) { // Print out the contents of each row into a table echo "
"; echo $row['Product_ID']; echo "
"; echo $row['Product_Name']; echo "
"; echo $row['Product_Quality']; echo "
"; echo $row['Product_Quantity']; echo "
"; } mysql_close($conn); ?>
A demo to load data from MysQL DB in Bootstrap Tab by $.post
Home
Reviews
Features
Products
Write something for home tab
Reviews Tab / Add reviews here
Present features here
Load Products Data