Re: Prepared Statements - Select - Bind Parameters w/ correction

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


On 9/27/2012 12:40 PM, Ethan Rosenberg, PhD wrote:
Dear list -


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 is

SELECT 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

Sounds like you are asking for a solution to a "programming problem" and not a syntax/language problem. If so, it would be better to see what YOU have already tried and ask for help in fixing or improving that.

We're not here to do your programming for you - just to help you with programming problems. We all have situations such as this where we spend the time to Solve the problem.

At first glance, I'd have my html present a set of checkboxes tied to the arguments, and then display a new, customized screen to ask for and accept the input only for the checked fields.

And btw - is that example of your bind statment REALLY the code as it exists in your current script? I think not. Tsk, Tsk.

PHP Database Mailing List (
To unsubscribe, visit:

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux