[development] Array

Damian Adriel Perez Valdes damian.adriel at gmail.com
Wed Jun 8 12:52:29 UTC 2011


thanks

On Wed, Jun 8, 2011 at 3:27 AM, Bob Hutchinson <hutchlists at midwales.com>wrote:

> On Tuesday 07 June 2011, Damian Adriel Perez Valdes wrote:
> > Hi:
> >
> > I have a select multiple, but i can´t get the values
> >
> > for ($i=0; $i < 2; $i++){
> >    $query3 = "INSERT INTO {usuarios} ( id_p, id_user ) values (
> > '".$last_id."', %d )";
> >    $queryResult3 = db_query ( $query3, $usuario[$i] );
> > }
> >
> > save a empty value.
> >
> > thanks
>
> This is a support question, not development so you are on the wrong list
> but
> here is an answer anyway:
>
> usuarios.id_p should be set to auto increment so you should not try to
> write
> to it at all, let mysql do it for you.
>
> for ($i=0; $i < 2; $i++){
>    $query3 = "INSERT INTO {usuarios} (id_user) VALUES (%d)";
>   if (! db_query ( $query3, array($usuario[$i]) ) ) {
>    drupal_set_message(t('Error while trying to insert.'), 'error');
>  }
> }
>
> For D7 use db_insert, see api.drupal.org for details.
>
>
> --
> -----------------
> Bob Hutchinson
> Midwales dot com
> -----------------
>



-- 
*Damián Adriel Pérez Valdés*
Programador de Sistemas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20110608/5b8bb261/attachment.html 


More information about the development mailing list