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

Home » Imported messages » comp.lang.php » mysqli - can I bind wildcard params, and just get a result back to make a hash?
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
mysqli - can I bind wildcard params, and just get a result back to make a hash? [message #173483] Fri, 15 April 2011 17:42 Go to next message
Tobiah is currently offline  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 #173484 is a reply to message #173483] Fri, 15 April 2011 17:56 Go to previous messageGo to next message
Luuk is currently offline  Luuk
Messages: 329
Registered: September 2010
Karma: 0
Senior Member
On 15-04-2011 19:42, Tobiah wrote:
> My version of php does not have the mysterious $stmt->get_result()
> method.

http://www.php.net/manual/en/mysqli.requirements.php
says:
The mysqli extension is designed to work with MySQL version 4.1.13 or
newer, or 5.0.7 or newer. For previous versions, please see the MySQL
extension documentation.

if your version of PHP is 4.x than its old.....

BTW, what version Do you have ?

--
Luuk
Re: mysqli - can I bind wildcard params, and just get a result back to make a hash? [message #173527 is a reply to message #173483] Mon, 18 April 2011 07:51 Go to previous messageGo to next message
alvaro.NOSPAMTHANX is currently offline  alvaro.NOSPAMTHANX
Messages: 277
Registered: September 2010
Karma: 0
Senior Member
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.



--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--
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 Go to previous message
Jerry Stuckle is currently offline  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
==================
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Stats comp.lang.php (last 7 days)
Next Topic: & - form and session problem!
Goto Forum:
  

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

Current Time: Thu Nov 21 14:38:14 GMT 2024

Total time taken to generate the page: 0.02640 seconds