Re: Prepared statements
| From: | Anthony Ettinger | Date: | Sun, 05 Mar 2006 02:55:38 +0000 |
| Subject: | Re: Prepared statements | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-231463@lists.php.net to get a copy of this message | ||
On 3/4/06, Julius Hacker <julius@finalfuture.de> 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@finalfuture.de
> >
> > 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