09-26-2017, 09:05 PM
I'm building am "add to cart" function via AJAX. When I load ini.php in the PHP file I call to in AJAX, it loads successfully, but I can't use any of the classes. The first thing I try to do is make a query call to the users table, andd I get this error:
PHP Fatal error: Call to a member function get() on null in...
$cart_query = $db->get('users',['username','=',$user->data()->username]);
That is the line of code that's throwing the error. I know I'm loading init.php successfully because I can echo something onto the screen. I had some trouble initially installing US on my server due to security measures over the fact I had PHP lower than 5.6. Same thing was happing, I was loading init.php successfully, but it was as if I was loading a blank file, no classes were coming through I could use. I'm wondering if there a security boundary I'm hitting. I've done all I can think of, I've included both the javascript file that my AJAX call is being made from as well of the PHP file my AJAX is calling to the admin pages, they are both passing the "if (!securePage($_SERVER['PHP_SELF'])){die();}" test. Not sure what to do from here, any help would be appreciated.
PHP Fatal error: Call to a member function get() on null in...
$cart_query = $db->get('users',['username','=',$user->data()->username]);
That is the line of code that's throwing the error. I know I'm loading init.php successfully because I can echo something onto the screen. I had some trouble initially installing US on my server due to security measures over the fact I had PHP lower than 5.6. Same thing was happing, I was loading init.php successfully, but it was as if I was loading a blank file, no classes were coming through I could use. I'm wondering if there a security boundary I'm hitting. I've done all I can think of, I've included both the javascript file that my AJAX call is being made from as well of the PHP file my AJAX is calling to the admin pages, they are both passing the "if (!securePage($_SERVER['PHP_SELF'])){die();}" test. Not sure what to do from here, any help would be appreciated.