Hi,
The following script essentially pulls the "title", "description" and "keywords" from the database if the page name in the database is matched with the currently loaded page. I have tested the database connection and that works 100%. Can anyone see what is wrong with the code for it not to display the correct results. Presently it is only displaying the output of the "else" syntax:
// Search database for pages matching the current
// page and display the title, description and keywords
$page = isset($_GET['page']) ? $_GET['page'] : 'home';
$sql = $mysqli->query("SELECT * FROM URL WHERE page = '" . $page . "' LIMIT 1");
if ($mysqli->connect_errno) {
printf("Connect failed: %s\n", $mysqli->connect_error);
exit();
}
if ($sql->num_rows > 0) {
while ($row = $sql->fetch_object())
{
$title = $row->title;
$description = $row->descr;
$keywords = $row->keywords;
}
} else {
$title = 'Set Default Title';
$description = 'Set Default Description';
$keywords = 'Set Default Keywords';
}