please correct this problem
id -- int
user_id -- int
friend_id -- int
<?
session_start(); //starts session
mysql_connect("localhost", "root", "");
mysql_select_db("admin");
if ($user_id= $_SESSION['logged']){ //check if user is logged in
if($_GET['user_id']){ //gets userid
$friend_id=$_GET['user_id']; //friend
$by = $user_id; //me
$query = "INSERT INTO friend_req ( 'friend_id , 'user_id' ) VALUES ( '$friend_id' , '$user_id' )"; //inserts the request
$result = mysql_query($query) or die(mysql_error());
echo ( "Friend request sent" ); //echo completion
}
else {
echo ( "No request was made" ); // or no request sent
}
}
else {
echo ( "You need to be logged in" ); //not logged in
}
?>
<form action = 'friend_request.php?user_id=<?php echo $user_id= $_SESSION['logged']?>' method='post'>
<input type = 'submit' value = 'Add as Friend'>