<?php
include_once('/inc/mysqli_connect.php'); // get database connection script
function getTableData() {
$connection = openConnection(); // connect to database
$query = mysqli_query($connection, 'SELECT `table_column_one`, `table_column_two` FROM `table_name`'); // create query to select records
if(mysqli_num_rows($query) > 0) { // if at least one record exists then...
while($option_row = mysqli_fetch_array($query, MYSQLI_NUM)) { // fetch query result as a numbered array and assign as $option_row
// Ref: $option_row[0] = 'table_column_one', $option_row[1] = 'table_column_two', etc etc
if($option_row[0] != condition) { // if current row matches condition then ...
// do not display record
} else { // otherwise do something with record
echo "<p>" . $option_row[0] . "</p>"; // Create p element with $option_row[0] as contents
echo "<p>" . $option_row[1] . "</p>"; // Create p element with $option_row[1] as contents
}
}
}
closeConnection($connection); // close database connection
}
?>