Destroying session
<p>i want to destroy a session by clicking on a link. if i click on that link the session will be destroyed, otherwise not. I don't know the exact code for this, but i have tried with this one : </p>

<pre><code>&lt;?php
echo $sess_destory = "&lt;a href='department.php'&gt; Back &lt;/a&gt;";

if($sess_destory)
{
session_destroy();  
}
?&gt;
</code></pre>

<p>In this way, the session is simply destroying before the time i want. That's why the desired data cannot pass through the other page and showing the error below :</p>

<p>"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(id, semester, sem_id) VALUES ('','Second Year First Semester','2-1')' at line 1"</p>
