/ Published in: Other
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php // Establish database connection $db_host = 'localhost'; $db_name = 'DB NAME'; $db_user = 'YOUR USER NAME'; $db_pass = 'YOUR PASSWORD'; $db_table = 'DB TABLE'; // Connect to database $link = mysql_connect($db_host, $db_user, $db_pass); $db = mysql_select_db($db_name); // Generate SELECT query $sql = "SELECT date_saved, atm, access, loan, checking, online, advantage, contact_name, contact_email, contact_zip FROM quiz_responses ORDER BY date_saved DESC"; $result = mysql_query($sql, $link); // Loop through the results/rows if ($result) { echo "<table id='quiz_responses' cellspacing='0' cellpadding='3' border='0'>n"; // Open a table while($row = mysql_fetch_array($result)) { // Pull each row from the table echo "<tr>n"; echo "</tr>n"; } } else { echo "No records were found. Perhaps the database is empty?"; } ?>