Not submitting info to database
What I am attempting to do is have a user pick a picture or two, and hit upload, it upload both files, and then submit the links to both files to the mysql db. The uploading is working fine, but it just wont submit the information to the database.
Auctually, since I've added the code which I thought would make it submit the info to the database, it doesnt upload the pictures, but I would assume once its fixed, it will work right.
PHP:<?php
//set where you want to store files
//in this example we keep file in folder upload
//$HTTP_POST_FILES['ufile']['name']; = upload file name
//for example upload file name cartoon.gif . $path will be upload/cartoon.gif
$path1 = "upload/".$HTTP_POST_FILES['ufile']['name'][0];
$path2 = "upload/".$HTTP_POST_FILES['ufile']['name'][1];
if($_POST['submit']) {
mysql_connect("mysql.wafflehousetour.com","tester","arrrs");
mysql_select_db("houses");
$title = $_POST['title'];
$message = $_POST['message'];
$sql=MYSQL_QUERY("INSERT INTO images (id,image,image2)".
"VALUES ('NULL', '$path1', '$path2')");
}
//copy file to where you want to store file
copy($HTTP_POST_FILES['ufile']['tmp_name'][0], $path1);
copy($HTTP_POST_FILES['ufile']['tmp_name'][1], $path2);
//$HTTP_POST_FILES['ufile']['name'] = file name
//$HTTP_POST_FILES['ufile']['size'] = file size
//$HTTP_POST_FILES['ufile']['type'] = type of file
echo "File Name :".$HTTP_POST_FILES['ufile']['name'][0]."<BR/>";
echo "File Size :".$HTTP_POST_FILES['ufile']['size'][0]."<BR/>";
echo "File Type :".$HTTP_POST_FILES['ufile']['type'][0]."<BR/>";
echo "<img src=\"$path1\" height=\"150\">";
echo "<P>";
echo "File Name :".$HTTP_POST_FILES['ufile']['name'][1]."<BR/>";
echo "File Size :".$HTTP_POST_FILES['ufile']['size'][1]."<BR/>";
echo "File Type :".$HTTP_POST_FILES['ufile']['type'][1]."<BR/>";
echo "<img src=\"$path2\" height=\"150\">";
echo "<P>";
?>
Last edited by Bobd314, August 5th, 2006 12:59 AM (Edited 1 times)
