Rechercher une fonction PHP

mssql_bind

(PHP 4 >= 4.0.7, PHP 5, PECL odbtp >= 1.1.1)

mssql_bindAdds a parameter to a stored procedure or a remote stored procedure

Warning

This function was REMOVED in PHP 7.0.0.

Alternatives to this function include:

Description

mssql_bind ( resource $stmt , string $param_name , mixed &$var , int $type [, bool $is_output = FALSE [, bool $is_null = FALSE [, int $maxlen = -1 ]]] ) : bool

Binds a parameter to a stored procedure or a remote stored procedure.

PHP: mssql_bind - Manual Home of Manuel PHP  Contents Haut

Parameters

stmt

Statement resource, obtained with mssql_init().

param_name

The parameter name, as a string.

Note:

You have to include the @ character, like in the T-SQL syntax. See the explanation included in mssql_execute().

var

The PHP variable you'll bind the MSSQL parameter to. It is passed by reference, to retrieve OUTPUT and RETVAL values after the procedure execution.

type

One of: SQLTEXT, SQLVARCHAR, SQLCHAR, SQLINT1, SQLINT2, SQLINT4, SQLBIT, SQLFLT4, SQLFLT8, SQLFLTN.

is_output

Whether the value is an OUTPUT parameter or not. If it's an OUTPUT parameter and you don't mention it, it will be treated as a normal input parameter and no error will be thrown.

is_null

Whether the parameter is NULL or not. Passing the NULL value as var will not do the job.

maxlen

Used with char/varchar values. You have to indicate the length of the data so if the parameter is a varchar(50), the type must be SQLVARCHAR and this value 50.

PHP: mssql_bind - Manual Home of Manuel PHP  Contents Haut

Return Values

Returns TRUE on success or FALSE on failure.

PHP: mssql_bind - Manual Home of Manuel PHP  Contents Haut

Examples

Example #1 mssql_bind() example

<?php
// Connect to MSSQL and select the database
mssql_connect('KALLESPC\SQLEXPRESS''sa''phpfi');
mssql_select_db('php');

// Create a new stored prodecure
$stmt mssql_init('NewUserRecord');

// Bind the field names
mssql_bind($stmt'@username',  'Kalle',  SQLVARCHAR,  false,  false,  60);
mssql_bind($stmt'@name',      'Kalle',  SQLVARCHAR,  false,  false,  60);
mssql_bind($stmt'@age',       19,       SQLINT1,     false,  false,   3);

// Execute
mssql_execute($stmt);

// Free statement
mssql_free_statement($stmt);
?>

PHP: mssql_bind - Manual Home of Manuel PHP  Contents Haut

See Also

Find a PHP function

English translation

You have asked to visit this site in English. For now, only the interface is translated, but not all the content yet.

If you want to help me in translations, your contribution is welcome. All you need to do is register on the site, and send me a message asking me to add you to the group of translators, which will give you the opportunity to translate the pages you want. A link at the bottom of each translated page indicates that you are the translator, and has a link to your profile.

Thank you in advance.

Document created the 30/01/2003, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/php-rf-function.mssql-bind.html

The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.

References

  1. View the html document Language of the document:fr Manuel PHP : http://php.net

These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.

Contents Haut