I am a real beginner at PHP and have tried to write the code below. I realise that a lot of it is probably wrong and the error .....Parse error: parse error, unexpected $ in.........comes up whenever i run it. If anyone could help me point out where ive gone wrong that would be great. And also, am i meant to disconnect from the database or something at the end?
$host = "*************";
$user = "**********";
$pass = "*******";
$db = "*******";
$connection = mysql_connect($host, $user, $pass) or die ("unable to connect");
mysql_select_db($db, $connection) or die ("unable to select database");
$sql="select * from addfriend where username2='$ses_username' ";
$res=mysql_query($sql);
$result = mysql_query($res) or die ("Error in query.".mysql_error());
if (mysql_num_rows($result) > 0)
{
echo 'You Are Already Friends';
}
else
{
print 'add as friend';