Re: [PHP-DEV] Making mysqli easier to use with parameters

2020-03-23 Thread Craig Francis
i easier to use > > -Original Message- > From: Craig Francis > Sent: Sunday, March 22, 2020 6:34 PM > To: Levi Morrison > Cc: PHP internals > Subject: Re: [PHP-DEV] Making mysqli easier to use with parameters > > On 22 Mar 2020, at 15:28, Levi Morrison > wrote: &

RE: [PHP-DEV] Making mysqli easier to use with parameters

2020-03-23 Thread Joel Hutchinson
namic binds on a single basis. This seems like low hanging fruit to make mysqli easier to use -Original Message- From: Craig Francis Sent: Sunday, March 22, 2020 6:34 PM To: Levi Morrison Cc: PHP internals Subject: Re: [PHP-DEV] Making mysqli easier to use with parameters On 22 Mar 202

Re: [PHP-DEV] Making mysqli easier to use with parameters

2020-03-22 Thread Craig Francis
On 22 Mar 2020, at 15:28, Levi Morrison wrote: > applying the ids array as `...` will handle the by-reference passing. That does help, thanks. But I still wonder if the ability to pass in a single array of parameters to `$statement->execute()` would remove a step, and be a bit easier to use f

Re: [PHP-DEV] Making mysqli easier to use with parameters

2020-03-22 Thread Levi Morrison via internals
> > $in_sql = implode(',', array_fill(0, count($ids), '?')); > > $sql = 'SELECT id, name FROM user WHERE id IN (' . $in_sql . ')'; > > if ($statement = $db->prepare($sql)) { > > $params = [str_repeat('i', count($ids))]; > foreach ($ids as $key => $value) { >

[PHP-DEV] Making mysqli easier to use with parameters

2020-03-22 Thread Craig Francis
Hi, Considering many new developers don't use a database abstraction, and instead copy/paste mysqli_query() examples. I'm just wondering, is there a way we can make it easier to use parameterised queries? Some initial thoughts below. Craig Take this semi-complex case, in that it's looki