I am trying to find information on the following error: Fatal error: Call to undefined method OnlineStore::setStoreID()
<p>I am copying an assignment from PHP Programming with MySQL (Chapter 10) and trying to get it to work correctly. I get the following error: Fatal error: Call to undefined method OnlineStore::setStoreID(). I don't understand why there is a problem. Can someone help me please?</p>

<p>Thank you.</p>

<p>Here is the php code:
    

<pre><code>if (class_exists("OnlineStore")) {
    if (isset($_SESSION['currentStore']))
    $Store = unserialize($_SESSION['currentStore']);
    else {
        $Store = new OnlineStore();
    }

$Store-&gt;setStoreID($storeID);
$storeInfo = $Store-&gt;getStoreInformation();
if (isset($_GET['ItemToAdd']))
    $Store-&gt;addItem();
}

else {
$ErrorMsgs[] = "The OnlineStore class is not available!";
$Store = NULL;
}
?&gt;
</code></pre>

<p>And here is the part of the other code:</p>

<pre><code>&lt;?php
class OnlineStore {
private $DBConnect = NULL;
private $storeID = "";
private $inventory = array();
private $shoppingCart = array();
}

function __construct() {
include("inc_OnlineStoreDB.php");
$this-&gt;DBConnect = $DBConnect;
}

function __destruct() {
if (!$this-&gt;DBConnect-&gt;connect_error)
$this-&gt;DBConnect-&gt;close();
}

function setStoreID($storeID) {
if ($this-&gt;storeID != $storeID) {
    $this-&gt;storeID = $storeID;
    $SQLString = "SELECT * FROM inventory " . " where storeID = '" . $this-    &gt;storeID . "'";
    $QueryResult = @$this-&gt;DBConnect-&gt;query($SQLString);
    if ($QueryResult === FALSE) {
        $this-&gt;storeID = "";
    }
    else {
        $this-&gt;inventory = array();
        $this-&gt;shoppingCart = array();
        while (($Row = $QueryResult-&gt;fetch_assoc())
                !== NULL) {
            $this-&gt;inventory[$Row['productID']] = array();
            $this-&gt;inventory[$Row['productID']] ['name'] =     $Row['name'];
            $this-&gt;inventory[$Row['productID']] ['description'] =     $Row['description'];
            $this-&gt;inventory[$Row['productID']] ['price'] =     $Row['price'];
            $this-&gt;shoppingCart[$Row['productID']] = 0;
        }
    }
}
}
</code></pre>
