Hi Guys, Anyone know what causes this message and how I could possibly go about troubleshooting it? "Fatal error: Call to a member function on a non-object in /home/url etc" The actual line that it portains to is the 2nd one down: session_start(); if(isset($_SESSION["member"]["id"])){ $memberid=$_SESSION["member"]["id"]; $hasOrdered = $orderTable->count("WHERE member_id='$memberid' AND status!='pending'")>0; } Code (markup): Any help appreciated!!
Thanks for that, so with that in mind, and considering I am new to PHP, in my statement above, what may not have been instantiated? And how could I go about trying to resolve it? Thanks
Thanks. Can someone tell me in psuedo what the entire statement is actually trying to achieve? I get the part about the site starting a session and trying to identify if a member has already been set with a session ID, but what is $hasOrdered = $orderTable->count("WHERE member_id='$memberid' AND status!='pending'")>0; Code (markup): trying to do? Then the statement ends...and of course it returns a fatal error...
AH thanks, so in theory...if a session is still active via the first statement, there is no need for the second as the rule in the first statement (ID assigned to [member] [id]) should keep the contents of the cart intact? What practical advantage would be gained from storing whether the user has placed an order already?
Thanks for the help. Ok, I managed to get the error to stop appearing by commenting out the line in question, but instead of returning the user to the page in question (which you can see from the code below), it is just sending th euser back to the homepage of the site... Can anyone help me get this working so that the user is returned to the appropriate thank you page in the code below? <?php require_once("info.php"); require_once("Table.php"); require_once("FrontView.php"); require_once("Controller.php"); require_once("CartBoxAction.php"); //contorl //install cart session_start(); if(isset($_SESSION["member"]["id"])){ $memberid=$_SESSION["member"]["id"]; $hasOrdered = $orderTable->count("WHERE member_id='$memberid' AND status!='pending'")>0; } //contorl this page action //check member who ordered $view = new FrontView(); $view->isLogged = isset($memberid); $view->hasOrdered = $hasOrdered; echo $view->render("payment-confirm-view.php"); ?> Code (markup): If i comment out the $hasOrdered above, could this cause the page to skip past the 'render' part of the code straight to the homepage? Thanks for all help so far
don't comment out $hasOrdered because it is used for the $view better find out whether $orderTable has been instantiated. look for something like "$orderTable = new something();" in the script or the other scripts that was included in the script.