0

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.

<?php
$uploaddir = './images/';
$file = $uploaddir.basename($_FILES);
$file_name=$_FILES;
$username=$_FILES;

if (move_uploaded_file($_FILES, $file)) {
require_once("connection.php");

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


?>

Thank You

2
Contributors
1
Reply
3
Views
5 Years
Discussion Span
Last Post by fobos
0

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

<?php
$username = $_SESSION['username']; 
?>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.