[PHP-DB] Arrays from forms....

2006-11-30 Thread Gary E. Terry
I have a problem. I have done this before, but can't find the files. I am using the following function to upload files from a form. foreach ($_FILES["pictures"]["error"] as $key => $error) { if ($error == UPLOAD_ERR_OK) { echo "$error_codes[$error]"; move_uploaded_file(

[PHP-DB] Multiple inserts into a database

2006-11-30 Thread Daniel Smith
The kind of thing I'm looking to do is to insert a variable number of records into a database as a consequence of a form entry. I am using PHP with a MySQL database to store information that is vaguely analogous to a fast food online ordering system. I have a table containing individual items with

Re: [PHP-DB] Arrays from forms....

2006-11-30 Thread Chris
Gary E. Terry wrote: I have a problem. I have done this before, but can't find the files. I am using the following function to upload files from a form. foreach ($_FILES["pictures"]["error"] as $key => $error) { if ($error == UPLOAD_ERR_OK) { echo "$error_codes[$error]"; move_

Re: [PHP-DB] Multiple inserts into a database

2006-11-30 Thread Chris
Daniel Smith wrote: The kind of thing I'm looking to do is to insert a variable number of records into a database as a consequence of a form entry. I am using PHP with a MySQL database to store information that is vaguely analogous to a fast food online ordering system. I have a table containing

Re: [PHP-DB] Arrays from forms....

2006-11-30 Thread Chris
Gary E. Terry wrote: I don't know if we are on the same page here... Maybe we are and I am just an idiot. The fields in my db are image1 image2 and image3. There are only three fields in the form that is being passed to the php script. But, on the form they are named "pictures[]". Here is the

RE: [PHP-DB] Arrays from forms....

2006-11-30 Thread Gary E. Terry
Sorry about that, not CC'ing the list... the values are not always empty, they should always have something in them... There should be 3 images uploading. But, I am sure just to make life interesting, there will be times when there could be as little as one uploaded. -Original Message-

Re: [PHP-DB] Arrays from forms....

2006-11-30 Thread Chris
Gary E. Terry wrote: Sorry about that, not CC'ing the list... the values are not always empty, they should always have something in them... There should be 3 images uploading. But, I am sure just to make life interesting, there will be times when there could be as little as one uploaded. I

RE: [PHP-DB] Arrays from forms....

2006-11-30 Thread Gary E. Terry
If I print them, there's nothing. all three Here is the same file, in test mode... $error) { if ($error == UPLOAD_ERR_OK) { echo "$error_codes[$error]"; move_uploaded_file( $_FILES["pictures"]["tmp_name"][$key], "bikeimages/" .$_FILES["pictures"]["name"][$key]

Re: [PHP-DB] Arrays from forms....

2006-11-30 Thread Chris
Gary E. Terry wrote: If I print them, there's nothing. all three Here is the same file, in test mode... $error) { if ($error == UPLOAD_ERR_OK) { echo "$error_codes[$error]"; move_uploaded_file( $_FILES["pictures"]["tmp_name"][$key], "bikeimages/" .$_FILES["

RE: [PHP-DB] Arrays from forms....

2006-11-30 Thread Gary E. Terry
Nope... here is the output. "-- -- Array ( [error] => )" -Original Message- From: Chris [mailto:[EMAIL PROTECTED] Sent: Thursday, November 30, 2006 10:56 PM To: Gary E. Terry Cc: php-db@lists.php.net Subject: Re: [PHP-DB] Arrays from forms Gary E. Terry wrote: > If I print them, th

Re: [PHP-DB] Arrays from forms....

2006-11-30 Thread Chris
Gary E. Terry wrote: Nope... here is the output. "-- -- Array ( [error] => )" So files aren't being uploaded properly at all. Does your form have: enctype="multipart/form-data" in the form header? ie Are your picture fields files? Upload file: -- Postgresql & php tutorials http

RE: [PHP-DB] Arrays from forms....

2006-11-30 Thread Gary E. Terry
OK.. I am a moron.. Forgot that I had changed the name of the field in the form, and got sidetracked and didn't change it in the php... But, still not working correctly. Here is the output: Array -- Array -- Array from: $error) { if ($error == UPLOAD_ERR_OK) { echo "$error_codes[

Re: [PHP-DB] Arrays from forms....

2006-11-30 Thread Chris
Gary E. Terry wrote: OK.. I am a moron.. Forgot that I had changed the name of the field in the form, and got sidetracked and didn't change it in the php... But, still not working correctly. Here is the output: Array -- Array -- Array Oops this: ${"image".($key+1)} = $_FILES['pictures']['name

RE: [PHP-DB] Arrays from forms....

2006-11-30 Thread Gary E. Terry
I know you really meant : ${"image".($key+1)} = $_FILES['pictures']['name'][$key]; And it works!!! Thanks oh so very much! -Original Message- From: Chris [mailto:[EMAIL PROTECTED] Sent: Thursday, November 30, 2006 11:46 PM To: Gary E. Terry Cc: php-db@lists.php.net Subject: Re: [PHP-

Re: [PHP-DB] Arrays from forms....

2006-11-30 Thread Chris
Gary E. Terry wrote: I know you really meant : ${"image".($key+1)} = $_FILES['pictures']['name'][$key]; Oh yeh ;) Glad we got there in the end! :) -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.