|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #31096 mysqli_stmt_bind_param drawbacks
Submitted: 2004-12-15 01:17 UTC Modified: 2011-01-01 23:52 UTC
From: glideraerobatics at hotmail dot com Assigned:
Status: Not a bug Package: MySQLi related
PHP Version: 5.0.2 OS:
Private report: No CVE-ID: None
 [2004-12-15 01:17 UTC] glideraerobatics at hotmail dot com
The function mysqli_stmt_bind_param() is a huge leap forward for PHP but still has a terrible drawback:

I use DAO (not the Micro$oft kind) classes that create their own SQL statements. These statements have varying numbers of fields and bind markers (the ? marks).

If one could pass an array of values to mysqli_stmt_bind_param(), then this problem could be solved, but it's not possible (yet).

Currently mysqli_stmt_bind_param() expects the programmer to just type in a list of variable names as parameters. To make things worse, you sometimes can't even use function calls as parameters because mysqli_stmt_bind_param() complains about non-referenced variables (or something).

Hopefully somebody bring PHP up to the level of other programming languages in this area.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-12-15 07:46 UTC]
We tried to keep mysqli simple and api conformant. 
Binding an array to mysql_stmt_bind_param (or bind_result) 
is pretty simple, so there is no need for providing a new 
function - you can do this with 3 lines in userland code: 
for ($i=0; $i < mysql_stmt_param_count($stmt); $i++) 
  $bindrow[] = &$row[$i]; 
call_user_func_array("mysqli_stmt_bind_result", $bindrow); 
 [2004-12-15 07:49 UTC]
last sample was incomplete: 
$bindrow[0] = $stmt; 
 [2011-01-01 23:52 UTC]
-Package: Feature/Change Request +Package: MySQLi related
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 17 15:01:31 2024 UTC