Hi,
This is my code so far, at the moment I get an error:
Fatal error: Cannot use object of type stdClass as array in /var/www/test/index.php on line 30
<?php require_once($_SERVER['DOCUMENT_ROOT']. "/include/config.php");
$page = isset($_GET['page']) ? $_GET['page'] : 'home';
$sql = $mysqli->query("SELECT * FROM admin WHERE id = '" . $page . "' LIMIT 1");
if ($mysqli->connect_errno) {
printf("Connect failed: %s\n", $mysqli->connect_error);
exit();
}
if ($sql->num_rows > 0) {
$row = $sql->fetch_object();
$title = $row['title']; // get title from database
$description = $row['description']; // get description from database
$keywords = substr($row['keywords'], 0, 250); // get keywords (250 characters) from database
} else {
$title = 'Administration Panel';
$description = 'description';
$keywords = '';
}
$sqlb = $mysqli->query("SELECT * FROM config");
if ($mysqli->connect_errno) {
printf("Connect failed: %s\n", $mysqli->connect_error);
exit();
}
if ($sqlb->num_rows > 0) {
$rowa = $sqlb->fetch_object();
$url = $rowa['adminurl'];
$email = $rowa['support_email'];
$legal = $rowa['legal'];
}
include($_SERVER['DOCUMENT_ROOT']. "include/header.php");
include('content/'.$page.'.php');
include($_SERVER['DOCUMENT_ROOT']. "include/footer.php");
?>
Im willing to learn and listen at the same time. I have got this far on my own so hopefully im learning something.
Any ideas how to improve or fix it will be gratefully received 🙂