RE: [PHP] \|/ html multiple select array and mysql
| From: | Michael Geier, CDM Systems Admin | Date: | Tue, 06 Nov 2001 17:59:29 +0000 |
| Subject: | RE: [PHP] \|/ html multiple select array and mysql | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-73629@lists.php.net to get a copy of this message | ||
$query = "insert into doctors values(
'',
'$nombre',
'$apellido1',
'$apellido2',
'$especialidad',
'".implode(",",$planes)."',
'$direccion_postal',
'$direccion2',
'$pueblo',
'$zip_code',
'$telefono',
'$fax',
'$website',
'$email',
'$idiomas',
'$intereses',
'$comentarios') ";
$result = mysql($query) or die ("could not execute");
http://www.php.net/implode
---
Michael Geier
CDM Sports, Inc. - Systems Administrator
email: mgeier@cdmsports.com
phone: 314.991.1511 x 6505
pager: 314.318.9414
-----Original Message-----
From: Gerry Figueroa Anadon [mailto:gerry@dynamicintermedia.com]
Sent: Tuesday, November 06, 2001 12:43 PM
To: php-general@lists.php.net
Subject: Re: [PHP] \|/ html multiple select array and mysql
Thanks:
I'm planing on using it to make a search form, so a coma separated format
would be my best guess.
Gerry
Sam Masiello wrote:
>
> This is because since $planes is an array, you can't simply reference it
as
> $planes to have all of its values go into your database table. When you
try
> to reference arrays or objects simply by their name, this is how PHP
returns
> to you the fact that this is of type "array" or "object." This is so you
> can change your code accordingly.
> How exactly were you planning on representing the data from the $planes
> array in your database?
>
> Sam Masiello
> Software Quality Assurance Engineer
> Synacor
> (716) 853-1362 X289
> smasiello@synacor.com
>
> ----- Original Message -----
> From: "Gerry Figueroa Anadon" <gerry@dynamicintermedia.com>
> To: <php-general@lists.php.net>
> Sent: Tuesday, November 06, 2001 1:26 PM
> Subject: [PHP] \|/ html multiple select array and mysql
>
> > Hello:
> >
> > I need to find out why my multiple[] array is loading the word "Array"
> into MySQl table instead of
> > the array values.
> >
> > I've search all the lists and all I've learned is to put the [] to make
my
> select an array.
> >
> > this is the html:
> > <select name="planes[]" multiple>
> > <option value="La_Reforma">La Reforma
> > <option value="Cruz_Azul">Cruz Azalea
> > <option value="Triple_SSS">Triple SSS
> > </select>
> >
> > and here is my sql:
> >
> > $result = mysql_query("insert into doctors values(\"\",
> > \"$nombre\",
> \"$apellido1\", \"$apellido2\",
> > \"$especialidad\", \"$planes\", \"$direccion_postal\",
> > \"$direccion2\",
> \"$pueblo\", \"$zip_code\",
> > \"$telefono\", \"$fax\", \"$website\", \"$email\",
> > \"$idiomas\",
> \"$intereses\", \"$comentarios\")")
> > or die ("could not execute");
> >
> > Before I learned to make the name an array I would just get the last or
> first value.
> >
> > I would gratelly appreciate a push in the right direction!!!
> >
> >
> > Many Thanks:
> > --
> > Gerry Figueroa
> > Dynamic Intermedia
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> > For additional commands, e-mail: php-general-help@lists.php.net
> > To contact the list administrators, e-mail: php-list-admin@lists.php.net
> >
--
Gerry Figueroa
Dynamic Intermedia
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net