Demo by jquery-az.com
jQuery, CSS and HTML
A jQuery post demo with MySQL DB and PHP
?The PHP code
< ?php //remove space in PHP tag $dbhostname = 'localhost'; $dbusername = 'username'; $dbpassword = 'password'; $conn = mysql_connect($dbhostname, $dbusername, $dbpassword); if(! $conn ) { die('Could not connect: ' . mysql_error()); } echo 'MySQL Connected successfully'."
"; mysql_select_db("DBName") or die(mysql_error()); echo "Connected to Database"."
"; $emp_salary = 7000; $emp_id = 3; $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 "
Product 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 jQuery post demo with MySQL DB and PHP