i5_setparam

 

Allocates parameter to parameterized request.

 

bool i5_setparam (

resource result,
int position, mixed value)

 

Details

 

Request must be prepared with i5_prepare function.

i5_setparam function is an alternative to the i5_bind_param function (automatically linked). It allows explicit value allocation to a parameter.

 

Parameters

 

stmt

i5_prepare prepared request ID

position

parameter index (marker) in the request

value

parameter allocated value

 

Returns:

True if OK, false if failed. 

 

I5_ERR_PHP_HDLDFT

256

No default connection found.

I5_ERR_PHP_OPTIONSTYPE

259

The type of " I5_OPTIONS_ALIAS" option must be x and not x

I5_ERR_PHP_OPTIONSNUMBER

260

Option number -1 is unknown.

I5_ERR_PHP_TYPEPARAM

262

Type of element x in parameter -1 must be y. Type z was provided.

 

 

Example

 

 

$insert = 'INSERT INTO animals (id, race, name, weight) VALUES (?, ?, ?, ?)';
$req = i5_prepare($insert);

$animals = array(0, 'cat', 'Mistinguette', 3.2);

if ($req) {
    $result = i5_execute($req, $animals);
    if ($result) {
        print "Mistinguette adding successful.";
    }
    i5_setparam($req, 3, "Minouche");

    i5_setparam($req, 4, 3.8);


    $result = i5_execute($req, $animals);
    if ($result) {
        print "Hercule adding successful.";
    }

 

 

See also

 

i5_prepare

i5_execute

i5_bind_param