FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » bind_param - vars not literals
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
bind_param - vars not literals [message #176675] Mon, 16 January 2012 21:09 Go to next message
oldyork90 is currently offline  oldyork90
Messages: 9
Registered: December 2011
Karma: 0
Junior Member
I don't know if this is a mysql or php question (seems like a hybrid),
so I apologize now to anyone who's upset... I get great stuff here,
so here I start.

I like to prep and bind all sql. The bind_param in php (needs
variables as bind values.

select * from x where colname in (?,?,?,?...)

I can build the type string, "iiii", and can walk the values to
bind... but how can I actually bind values? php wants vars.

I can't do these: $sth->bind_params("iiii", 1,2,3,4), or $sth-
> bind_params("iiii", join(" ,", arrayWithValues)) or $sth-
> bind_params("iiii", arrayWithValues)

It appears that I might be able to use named binding parameters or I
could build var names and set them... but is that the only way?
Suggestions?

If this is really a mysql question, please ignore. I'll remove it in
a few days and repost over there (where ever it is)

Thank you. ... really
Re: bind_param - vars not literals [message #176677 is a reply to message #176675] Mon, 16 January 2012 21:41 Go to previous message
oldyork90 is currently offline  oldyork90
Messages: 9
Registered: December 2011
Karma: 0
Junior Member
On Jan 16, 3:09 pm, oldyork90 <oldyor...@yahoo.com> wrote:
> I don't know if this is a mysql or php question (seems like a hybrid),
> so I apologize now to anyone who's upset...  I get great stuff here,
> so here I start.
>
> I like to prep and bind all sql.  The bind_param in php (needs
> variables as bind values.
>
> select * from x where colname in (?,?,?,?...)
>
> I can build the type string, "iiii", and can walk the values to
> bind... but how can I actually bind values?  php wants vars.
>
> I can't do these: $sth->bind_params("iiii", 1,2,3,4), or $sth-
>
>> bind_params("iiii", join(" ,", arrayWithValues)) or $sth-
>> bind_params("iiii", arrayWithValues)
>
> It appears that I might be able to use named binding parameters or I
> could build var names and set them... but is that the only way?
> Suggestions?
>
> If this is really a mysql question, please ignore.  I'll remove it in
> a few days and repost over there (where ever it is)
>
> Thank you. ... really

holy hanna!
http://stackoverflow.com/questions/12656/php-mysqli-variable-parameter-resu lt-binding-with-prepared-statements
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: php with openssl in static mode (binaries for windows)
Next Topic: Why and wherefore file downloads
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Tue Nov 26 11:25:32 GMT 2024

Total time taken to generate the page: 0.03189 seconds