Re: Prepared statements

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

 



Curt Zirzow wrote:

> > On Mon, Mar 06, 2006 at 10:03:10PM +0100, Julius Hacker wrote:
> >   
>   
>> >> Curt Zirzow wrote:
>> >>     
>>     
>>> >>> I assume your loop is something like:
>>> >>>   while(condition) {
>>> >>>     $auction_parts['id'] = 'some value';
>>> >>>     $auction_parts['name'] = 'some value';
>>> >>>     ...
>>> >>>     $insert->execute();
>>> >>>   }
>>> >>>   
>>> >>>       
>>>       
>> >> Yes, thats it.
>> >>
>> >>     
>>     
>>> >>> My first guess would be, if not aleady done, initialize
>>> >>> $auction_parts before you do your bind_param() with something like:
>>> >>>
>>> >>>   $auction_parts = array('id' => null, 'name' => null, ...);
>>> >>>   $insert->bind_param("issdsis", $auction_house["id"], ...);
>>> >>>   
>>> >>>       
>>>       
>> >> Unfortunately it helps nothing  :-( 
>> >>     
>>     
> >
> > Ok, i didn't really think it would but might have shown a obvious
> > bug with mysqli. 
> >
> > According to your original post it was odd that the update prepared
> > statment didn't complain about a NULL value, but the insert did,
> > and it does seem to be related to bind_param and prepare.
> >
> > What are your versions of:
> >   php?
> >   mysql_client php is built with?
> >   mysql server you are connecting to?
> >   
>   
I've alread a solution, just forgot to post here  :) 
Anthony gave me the hint as he sent me a list of the datatypes accepted
by bind_param and so I checked the datatypes of the variables and have
seen that $auction_house["id"] was a string and not an integer.
After I converted it to an integer, it works properly.

I don't know exactly why it worked if I did bind_param in the loop but I
think it's because it saw there that I gave him a string and converted
it automatically to integer.

-- 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


[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