Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #8685

Re: mysqli_stmt_bind_param with multiple parameters in an array

From "Peter H. Coffin" <hellsop@ninehells.com>
Newsgroups comp.lang.php
Subject Re: mysqli_stmt_bind_param with multiple parameters in an array
Date 2013-03-16 11:51 -0500
Organization A noiseless patient Spider
Message-ID <slrnkk98o3.m9f.hellsop@nibelheim.ninehells.com> (permalink)
References <3b9ec35e-f117-41e3-8411-59bb81b0e9d7@googlegroups.com> <473c1a06-9889-4163-ac25-930f2eb0fff3@googlegroups.com>

Show all headers | View raw


On Sat, 16 Mar 2013 08:46:57 -0700 (PDT), Chris Cosner wrote:
> Thanks, guys.
>
> So I definitely cannot drop an array in there.
>
> Yet I don't want to create 100+ variables for this INSERT.
>
> Not possible with bound parameters?

Cannot use an array for this. Can implode an array to a string using a
comma as a separator then use the string to construct the query you want
to bind. The usual caveats about "if this array is constructed using
data from outside your app, it can be a vector for an injection attack
on your DB" apply. Which is a common reason for people to be using bound
statements in the first place, so think carefully.

-- 
A: Maybe because some people are too annoyed by top-posting.
Q: Why do I not get an answer to my question(s)?
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?  

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

mysqli_stmt_bind_param with multiple parameters in an array burrowingowl@gmail.com - 2013-03-15 17:47 -0700
  Re: mysqli_stmt_bind_param with multiple parameters in an array Jerry Stuckle <jstucklex@attglobal.net> - 2013-03-15 22:45 -0400
  Re: mysqli_stmt_bind_param with multiple parameters in an array "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2013-03-16 12:39 +0100
  Re: mysqli_stmt_bind_param with multiple parameters in an array Chris Cosner <burrowingowl@gmail.com> - 2013-03-16 08:46 -0700
    Re: mysqli_stmt_bind_param with multiple parameters in an array Jerry Stuckle <jstucklex@attglobal.net> - 2013-03-16 11:58 -0400
    Re: mysqli_stmt_bind_param with multiple parameters in an array "Peter H. Coffin" <hellsop@ninehells.com> - 2013-03-16 11:51 -0500
    Re: mysqli_stmt_bind_param with multiple parameters in an array "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2013-03-16 18:04 +0100
  Re: mysqli_stmt_bind_param with multiple parameters in an array Chris Cosner <burrowingowl@gmail.com> - 2013-03-16 11:42 -0700

csiph-web