maxdb_stmt_param_count

maxdb_stmt::param_count

(PECL maxdb >= 1.0)

maxdb_stmt_param_count -- maxdb_stmt::param_countReturns the number of parameter for the given statement

说明

过程化风格

maxdb_stmt_param_count ( resource $stmt ) : int

面向对象风格

int $maxdb_stmt->param_count;

maxdb_stmt_param_count() returns the number of parameter markers present in the prepared statement.

返回值

returns an integer representing the number of parameters.

范例

Example #1 面向对象风格

<?php
$maxdb 
= new maxdb("localhost""MONA""RED""DEMODB");

/* check connection */
if (maxdb_connect_errno()) {
   
printf("Connect failed: %s\n"maxdb_connect_error());
   exit();
}

if (
$stmt $maxdb->prepare("SELECT name FROM hotel.city WHERE name=? OR state=?")) {

   
$marker $stmt->param_count;
   
printf("Statement has %d markers.\n"$marker);

   
/* close statement */
   
$stmt->close();
}

/* close connection */
$maxdb->close();
?>

Example #2 过程化风格

<?php
$link 
maxdb_connect("localhost""MONA""RED""DEMODB");

/* check connection */
if (maxdb_connect_errno()) {
   
printf("Connect failed: %s\n"maxdb_connect_error());
   exit();
}

if (
$stmt maxdb_prepare($link"SELECT name FROM hotel.city WHERE name=? OR state=?")) {

   
$marker maxdb_stmt_param_count($stmt);
   
printf("Statement has %d markers.\n"$marker);

   
/* close statement */
   
maxdb_stmt_close($stmt);
}

/* close connection */
maxdb_close($link);
?>

以上例程的输出类似于:

Statement has 2 markers.

参见

相关文章
php date/time 函数 returns associative array with detailed info about given datephp ibm db2 函数 returns the number of rows affected by an sql statementphp imap 函数 this function returns the uid for the given message sequence numberphp maxdb 函数 returns the number of columns for the most recent queryphp maxdb 函数 returns a string representing the type of connection usedphp maxdb 函数 returns the total number of rows changed deleted or inserted by the last executed statementphp maxdb 函数 returns the error code for the most recent statement callphp maxdb 函数 returns a string description for last statement errorphp maxdb 函数 frees stored result memory for the given statement handlephp maxdb 函数 initializes a statement and returns an resource for use with maxdb stmt preparephp maxdb 函数 returns the number of parameter for the given statementphp maxdb 函数 returns result set metadata from a prepared statementphp maxdb 函数 returns sqlstate error from previous statement operationphp maxdb 函数 returns whether thread safety is given or notphp maxdb 函数 returns the number of warnings from the last query for the given linkphp oci8 函数 returns the next child statement resource from a parent statement resource that has oracle database 12c implicit result setsphp sqlite 函数 returns the number of rows that were changed by the most recent sql statementphp statistic 函数 calculates any one parameter of the poisson distribution given values for the othersphp mysqli stmt returns the number of field in the given statementphp mysqli stmt returns the number of parameter for the given statement
关注编程学问公众号