MySQLi binding params and results and where in a loop they should be placed.

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

 



Hi.

Just looking for some clarity before I spend an hour trying to figure out
if I'm doing it right.

I'm reading a stream of product data from an external source.

I'm needing to tag the data as it goes through the system, indicating if
the product has been seen before.

So, I'm using a prepared statement with 2 params that identify the product
uniquely from the external source.

So, I have a prepare(), bind_param(), execute(), bind_result() and fetch().

I think prepare() and bind_param() take place outside of the loop.

And population of the bound variables, execute(), bind_result() and fetch()
all take place inside the loop.

Is that right?

Or can I bind_result BEFORE execute(), so all I need to do is populate the
bound variable (which is done from the reading from the external stream),
execute() and fetch().

The examples in the manual don't really demonstrate the re-use of a
prepared statement, making it both a little vague and pointless (excluding
the OBVIOUS advantage of sql injection protection - I'm using prepared
statements mainly for that reason).


-- 
Richard Quadling
Twitter : EE : Zend : Fantasy Shopper
@RQuadling : http://e-e.com/M_248814.html : http://bit.ly/9O8vFY :
http://fan.sh/106/5tw

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux