Welcoming Guest using SQL tables
<p>I have this code currently inside of my page.</p>

<pre><code>&lt;?php
        if ($admin-&gt;get_permissions()==3)
        echo 'Welcome Administrator';
        elseif ($admin-&gt;get_permissions()==1)
        echo 'Welcome User';
        else
        echo 'Welcome Guest';

        ?&gt;
</code></pre>

<p>Now if you're logged in as an admin or a standard user it works fine, but if you're visiting the site as a guest then it gives the error</p>

<pre><code>Call to a member function get_permissions() on a non-object in
</code></pre>

<p>The error begins at the start of this script. How could I make sure that the get_permissions function works for people logged in and displays custom data for them and also displays information for a guest logged in?
I've been racking my brain around this to no avail. If anybody can help it'd be much appreciated.</p>
