Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

File upload error 1

Status
Not open for further replies.

vincelewin

IS-IT--Management
May 16, 2002
83
GB
Can anyone explain why this wont work?

I have a input=file object on the form called pix.
The file uploads but the script below just wont update the record.

$picturequery = "UPDATE adds SET picture={$_FILES['pix']['name']} where accountno=$_POST[record]";

$pictureresult = mysql_query($picturequery) or die ("Couldn't execute the Update picture Query.");

My mysql table field is called picture and the type is varchar(255). The table row already exists and I am just trying to update the record part of the table row.

I also have another form to upload when creating the initial record. This works, sometimes but thats another story. When it creates the whole row it inserts the picture name no problem.

For the record, I did attempt to just use a text field to update the row with a string of text i.e. image.gif. This also failed.

Any help would be greatly appreciated.
 
Get some better debugging.

Change:

$pictureresult = mysql_query($picturequery) or die ("Couldn't execute the Update picture Query.");

To:

$pictureresult = mysql_query($picturequery) or die (mysql_error());


I'd bet at first blush that it's something to do with missing singlequotes around strings in a query. But that error output should tell you exactly.



Want the best answers? Ask the best questions! TANSTAAFL!
 
Hey u, have a star.

I feel like a fool now.

Thanks for the advice. Less than 30seconds after reading your post it was working.

Vince
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top