I'm having trouble fixing my errors, the functions are working fine but i need to get rid of the errors
i have this following errors:
Warning: Illegal string offset 'userID' in C:\xampp\htdocs\checkout.php on line 15
Notice: Uninitialized string offset: 0 in C:\xampp\htdocs\checkout.php on line 15
Fatal error: Call to a member function fetch_assoc() on boolean in C:\xampp\htdocs\checkout.php on line 19
and heres my code:
CHECKOUT.PHP
<?php
// include database configuration file
include 'dbConfig.php';
include 'login.php';
// initializ shopping cart class
include 'Cart.php';
$cart = new Cart;
// redirect to home if cart is empty
if($cart->total_items() <= 0){
header("Location: index.php");
}
// set customer ID in session
$_SESSION['sessCustomerID'] = $sessData['userID']; //this is the ID for the logged in user
// get customer details by session customer ID
$query = $db->query("SELECT * FROM users WHERE id =".$_SESSION['sessCustomerID']);
$custRow = $query->fetch_assoc();
?>
LOGIN.PHP
<?php
session_start();
$sessData = !empty($_SESSION['sessData'])?$_SESSION['sessData']:'';
if(!empty($sessData['status']['msg'])){
$statusMsg = $sessData['status']['msg'];
$statusMsgType = $sessData['status']['type'];
unset($_SESSION['sessData']['status']);
}
?>
<div class="container">
<?php
if(!empty($sessData['userLoggedIn']) && !empty($sessData['userID'])){
include 'user.php';
$user = new User();
$conditions['where'] = array(
'id' => $sessData['userID'],
);
$conditions['return_type'] = 'single';
$userData = $user->getRows($conditions);
?>
DBCONFIG.PHP
<?php
//DB details
$dbHost = 'localhost';
$dbUsername = 'root';
$dbPassword = '';
$dbName = 'dbblair';
//Create connection and select DB
$db = new mysqli($dbHost, $dbUsername, $dbPassword, $dbName);
if ($db->connect_error) {
die("Unable to connect database: " . $db->connect_error);
}
?>