mysqli - can I bind wildcard params, and just get a result back to make a hash? [message #173483] |
Fri, 15 April 2011 17:42 |
Tobiah
Messages: 30 Registered: April 2011
Karma: 0
|
Member |
|
|
My version of php does not have the mysterious $stmt->get_result()
method. Without that, I can't see my path to getting an assoc array
back from a fetch after doing '?' wildcard parameter binding.
The bind_result() method is too tedious to maintain when a table
with a large number of fields is queried and the structure of the
table is under development.
Now, I'm kludging this together using call_user_func_array() and
stuffing variable references into the argument array, but it's
pretty awkward. Maybe this is why get_result() was invented,
although the docs say that it may only be in SVN, and my php
does not have it.
Thanks!
Tobiah
|
|
|
|
|
Re: mysqli - can I bind wildcard params, and just get a result back to make a hash? [message #173531 is a reply to message #173527] |
Mon, 18 April 2011 09:44 |
Jerry Stuckle
Messages: 2598 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
On 4/18/2011 3:51 AM, "Álvaro G. Vicario" wrote:
> El 15/04/2011 19:42, Tobiah escribió/wrote:
>> My version of php does not have the mysterious $stmt->get_result()
>> method.
>
> http://es2.php.net/manual/en/mysqli-stmt.get-result.php
>
> «(No version information available, might only be in SVN)»
>
> It looks that no version of PHP has that feature yet.
>
>> Without that, I can't see my path to getting an assoc array
>> back from a fetch after doing '?' wildcard parameter binding.
>
> That's one of the reasons why many of use hate the mysqli extension: it
> only supports associative arrays in result sets when you *don't* use
> prepared statements. Your only options are:
>
> 1. Stick to mysqli and use numeric arrays.
> 2. Switch to another extension like PDO.
>
>
>
Or don't use prepared statements and escape the strings yourself.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
|
|
|