this is my SESSION code i want to make function of it
is this posible?
i am new in php i want your help
please guide me
<?php
include "connection.php";
$result = mysql_query("SELECT * FROM new WHERE Email='" . $_POST['email'] . "' and Password = '". $_POST['pass']."'");
$row = mysql_fetch_array($result);
if(is_array($row)){
$_SESSION["ID"] = $row['ID'];
$_SESSION["Email"] = $row['Email'];
$_SESSION["Title"] = $row['Title'];
}
else {
echo "Invalid details!";
}
if(isset($_SESSION["ID"])){
echo"welcome</br>". $_SESSION["Title"];
echo"</br><a href='logout.php'>Log out</a>";
}
?>