Re: inserting mysql data using php array???
| From: | justin gruenberg | Date: | Tue, 27 Nov 2001 22:59:10 +0000 |
| Subject: | Re: inserting mysql data using php array??? | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-14629@lists.php.net to get a copy of this message | ||
meaning
INSERT INTO table (first_name,middle_name,last_name,suffix)
VALUES($an_array)
no. that is not possible.
you do actually have to write it out..
INSERT INTO table (first_name,middle_name,last_name,suffix)
VALUES('$name[0]', '$name[1]', '$name[2]', $name[3])
I dont understand why you have these in arrays if they are only simple text
inputs. it'd be much easier to understand your code visually if you had the
name of each field actually descriptive of the content in it. It is also
not valid html to have [ ]'s in the name parameter, I believe.
----- Original Message -----
From: "Ubaidul Khan" <ubaidulkhan@hotmail.com>
To: <php-db@lists.php.net>
Sent: Tuesday, November 27, 2001 9:45 AM
Subject: [PHP-DB] inserting mysql data using php array???
Hi
I am running Apache 1.3.20 with MySQL 3.23.41, and PHP 4.0.6, on Linux
Mandrake 8.1. I am trying to access a MySQL database from a PHP script. I
have a html form, that takes input in an array (ie. name[0], name[1],
name[2], name[3], these fields represent first_name, middle_initial,
last_name, and suffix in the database). What I would really like to do is,
take this array of data and insert each element in the corresponding column,
in the database. Is it possible to insert each element of the array into
the database, using an array, instead of typing out each value?
--
Thanks