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 :
<?php
echo $sess_destory = "<a href='department.php'> Back </a>";
if($sess_destory)
{
session_destroy();
}
?>
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 :
"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"