I'm building a photography website where I have one page that displays the pictures (bootstrapped and all) and then another page so I can upload new photos (consists of an html page with form and php that runs download code). In this php page I want to make an SQL addition to my column name in database photos. I want to add the file name into the SQL database name so I can later access it in my page displaying the photos and I can get the file name so I can for loop it there for all the pictures in the directory. The issue I'm having is adding the target file into the name and then getting it. Here's my code for adding the filename:
$link = mysql_connect('meadowebcom.ipagemysql.com', 'lphotos', 'gut2*EMI_12');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_select_db(photos);
$sql = 'INSERT INTO `name` (`target_file`) VALUES ('.basename( $_FILES["fileToUpload"]["name"]).');';
$retval = mysql_query( $sql, $conn );
if(! $retval ) {
die('Could not enter data: ' . mysql_error());
}
echo "Entered data successfully\n";
mysql_close($conn);
I have it display that I am connected but can't add anything. I haven't even started on getting the file in the other file. I don't usually do PHP outside of contact and registration forms so any help or any points in the right direction would help.