note 80119 added to function.mysqli-stmt-bind-param

From: Date: Sun, 30 Dec 2007 13:00:17 +0000
Subject: note 80119 added to function.mysqli-stmt-bind-param
Groups: php.notes 
Request: Send a blank email to php-notes+get-134282@lists.php.net to get a copy of this message
Small correction. This version removes the NULL element from the array, so it doesn't fall on to the next ? when passed to mysql_stmt_bind_param(). Note that $saParams is still passed by reference, but now it is being modified. <?php function preparse_prepared($sQuery, &$saParams) { $nPos = 0; $sRetval = $sQuery; foreach ($saParams as $x_Key => $Param) { //if we find no more ?'s we're done then if (($nPos = strpos($sQuery, '?', $nPos + 1)) === false) { break; } //this test must be done second, because we need to increment offsets of $nPos for each ?. //we have no need to parse anything that isn't NULL. if (!is_null($Param)) { continue; } //null value, replace this ? with NULL. $sRetval = substr_replace($sRetval, 'NULL', $nPos, 1); //unset this element now unset($saParams[$x_Key]); } return $sRetval; } ?> ---- Server IP: 69.147.83.197 Probable Submitter: 76.28.182.137 ---- Manual Page -- http://www.php.net/manual/en/function.mysqli-stmt-bind-param.php Edit -- https://master.php.net/note/edit/80119 Del: integrated -- https://master.php.net/note/delete/80119/integrated Del: useless -- https://master.php.net/note/delete/80119/useless Del: bad code -- https://master.php.net/note/delete/80119/bad+code Del: spam -- https://master.php.net/note/delete/80119/spam Del: non-english -- https://master.php.net/note/delete/80119/non-english Del: in docs -- https://master.php.net/note/delete/80119/in+docs Del: other reasons-- https://master.php.net/note/delete/80119 Reject -- https://master.php.net/note/reject/80119 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#134282) next »