Hello Everyone,

I am having a very basic problem in PHP MYSQL. My requirement is to add images in MYSQL through PHP along with the username. I have managed to store images in MYSQL but I dont know how to store username along with that image uploading query. Just like facebook where you upload images and they go into facebook database along with your username. Here is the basic query I am writing. Any help would be greatly appreciated.

$uploaddir = './images/';
$file = $uploaddir.basename($_FILES);

if (move_uploaded_file($_FILES, $file)) {

$sql=mysql_query("INSERT INTO `picture` (`id`, `date`, `ip`, `filename`, `username`) VALUES ('', '".date('d-m-Y')."', '".$_SERVER['REMOTE_ADDR


Thank You

Well if you can succesfully upload the image, just use the session username for the value.

$username = $_SESSION['username'];