thanks<br><br><div class="gmail_quote">On Wed, Jun 8, 2011 at 3:27 AM, Bob Hutchinson <span dir="ltr"><<a href="mailto:hutchlists@midwales.com">hutchlists@midwales.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div></div><div class="h5">On Tuesday 07 June 2011, Damian Adriel Perez Valdes wrote:<br>
> Hi:<br>
><br>
> I have a select multiple, but i can´t get the values<br>
><br>
> for ($i=0; $i < 2; $i++){<br>
> $query3 = "INSERT INTO {usuarios} ( id_p, id_user ) values (<br>
> '".$last_id."', %d )";<br>
> $queryResult3 = db_query ( $query3, $usuario[$i] );<br>
> }<br>
><br>
> save a empty value.<br>
><br>
> thanks<br>
<br>
</div></div>This is a support question, not development so you are on the wrong list but<br>
here is an answer anyway:<br>
<br>
usuarios.id_p should be set to auto increment so you should not try to write<br>
to it at all, let mysql do it for you.<br>
<div class="im"><br>
for ($i=0; $i < 2; $i++){<br>
</div> $query3 = "INSERT INTO {usuarios} (id_user) VALUES (%d)";<br>
if (! db_query ( $query3, array($usuario[$i]) ) ) {<br>
drupal_set_message(t('Error while trying to insert.'), 'error');<br>
}<br>
}<br>
<br>
For D7 use db_insert, see <a href="http://api.drupal.org" target="_blank">api.drupal.org</a> for details.<br>
<font color="#888888"><br>
<br>
--<br>
-----------------<br>
Bob Hutchinson<br>
Midwales dot com<br>
-----------------<br>
</font></blockquote></div><br><br clear="all"><br>-- <br>*Damián Adriel Pérez Valdés*<br>Programador de Sistemas<br><br><br>