Prepared Statements - Select - Bind Parameters w/ correction
| From: | Ethan Rosenberg, PhD | Date: | Thu, 27 Sep 2012 16:40:48 +0000 |
| Subject: | Prepared Statements - Select - Bind Parameters w/ correction | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-48545@lists.php.net to get a copy of this message | ||
Dear list -
SEE CORRECTION IN $_POST VARIABLE BELOW.
Thanks to all for your help.
I hope [??] that this question will solve all the remaining problems.
So that we are on the same page, here is what was previously stated.
mysqli_stmt_bind_param expects three variables, in this order ---- mysqli_stmt_bind_param($stmt, "num", $a, $b, $c)
Where stmt is the query w/ the ?? that isSELECT Site, MedRec, Fname, Lname, Phone, Height, Sex, Hx, Bday, Age FROM Intake3 where 1 AND (Site = ?) AND (MedRec = ?) AND (Sex = ?) and num is the number and type of variables is the query, in this case 'sis' $a $b and $c are the variables to be inserted, in this case: $a = $_POST['Site']; $b = $_POST['MedRec']; $c = $_POST['Sex']; As I seem to have found, the variables cannot be a string or components of an imploded array. This is a search function that will take patient supplied data and search the Intake database to determine the Medical Record Number. There are nine variables in the database, and I never know which variables the patient will give. Based on the database, it is easy to set up the correspondence. The database is searched in the order of the correspondence and the letters can be immediately determined... $a = $_POST['Site'] $b = $_POST['MedRec'] $c = $_POST['Fname'] $d = $_POST['Lname'] $e = $_POST['Phone'] $f = $_POST[Height'] $g = $_POST['Sex'] $h = $_POST['Hx'] $i = $_POST['Bday'] $i = $_POST['Age'] <----- Corrected The challenge is to be able to dynamically select the variables that will go intomysqli_stmt_bind_param. Advice and help, please Ethan