Banner

Sponsor

Login


Welcome Back!
Guest
Guest

Register

Lost your password?

92 users online



Not submitting info to database

Not submitting info to database

Currently viewing this thread: 1 (0 members and 1 guests)


Bobd314

Bobd314

Neverside Newbie
Status: Offline!

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)

eXer-o

eXer-o

the eXtreme-o dEsign-o!
Status: Offline!

try changing

PHP:

<?php

     $sql
=MYSQL_QUERY("INSERT INTO images (id,image,image2)".
        
"VALUES ('NULL', '$path1', '$path2')");

?>

to

PHP:

<?php

     mysql_query
("INSERT INTO images (id,image,image2)".
        
"VALUES ('NULL', '$path1', '$path2')");

?>

TheClincher

TheClincher

Lost in Berkeley, CA
Status: Offline!

Is ID a unique, auto-incrementing, primary key? You can try removing that value from your insert if it is - it would auto-increment. So, remove id and NULL from your query.

By the way, you should really hide your database information.

___________________

There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live.

Last edited by TheClincher, August 7th, 2006 08:13 AM (Edited 1 times)

Quick Jump:

Main Navigation


Site & Graphic Design by Aeon Tan
Developed by Jeremie Pelletier & Scott Roach


NeverAPI generated this page in 0.0088 seconds.