Re: Prepared statements

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 3/4/06, Julius Hacker <julius@xxxxxxxxxxxxxx> wrote:
> One other thing:
> If I do the bind_param within the loop, it just works.
>
> The curious is that I have to prepared statements for this loop (one for
> inserting data and one for updating data) and the one for updating data
> works and that for inserting don't.
> Both statements are 100% valid.
>
> Julius Hacker wrote:
> > Hi,
> >
> > so I need help again:
> > I want to use prepared statements to insert lots of data in my
> > MySQL-database.
> > For that I use foreach because I have an array containing all necessary
> > information.
> >
> > Before that foreach, I use mysqli_stmt_init, mysql_stmt_prepare and
> > mysql_stmt_bind_param.
> > In the foreach-loop I give the variables, which I bound with bind_param,
> > their values and want to execute the statement.
> >
> > But now MySQL returns always an error.
> > It seems that the values I gave the variables in the loop aren't used
> > because I used bind_param before that.
> >
> > In the example for mysql_bind_param they do it like me.
> > Is the example also wrong or do I have to consider something special?
> >
> > --
> > Regards
> > Julius Hacker
> >
> > http://www.julius-hacker.de
> > julius@xxxxxxxxxxxxxx
> >
> > OpenPGP-Key-ID: 0x4B4A486E
> >
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>

Can you dump the error string reported back from the mysql database
connection? Could provide some insight as to why your INSERT fails,
and the UPDATE works.

--
Anthony Ettinger
Signature: http://chovy.dyndns.org/hcard.html

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux