PHP
downloads | documentation | faq | getting help | mailing lists | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

mysqli_stmt::prepare> <mysqli_stmt::num_rows
Last updated: Fri, 05 Dec 2008

view this page in

mysqli_stmt->param_count

mysqli_stmt_param_count

(PHP 5)

mysqli_stmt->param_count -- mysqli_stmt_param_countRetourne le nombre de paramètre d'une commande SQL

Description

Style orienté objet (propriétés) :

mysqli_stmt
int $param_count;

Style procédural :

int mysqli_stmt_param_count ( mysqli_stmt $stmt )

Retourne le nombre de variables attendues par la commande préparée stmt .

Liste de paramètres

stmt

Style procédural uniquement : Un identifiant de requête retourné par la fonction mysqli_stmt_init().

Valeurs de retour

Retourne un entier représentant le nombre de paramètres.

Exemples

Exemple #1 Style orienté objet

<?php
$mysqli 
= new mysqli("localhost""my_user""my_password""world");

/* Vérifie la connexion */
if (mysqli_connect_errno()) {
    
printf("Échec de la connexion : %s\n"mysqli_connect_error());
    exit();
}

if (
$stmt $mysqli->prepare("SELECT Name FROM Country WHERE Name=? OR Code=?")) {

    
$marker $stmt->param_count;
    
printf("La requête a %d variables.\n"$marker);

    
/* Fermeture de la commande */
    
$stmt->close();
}

/* Fermeture de la connexion */
$mysqli->close();
?>

Exemple #2 Style procédural

<?php
$link 
mysqli_connect("localhost""my_user""my_password""world");

/* Vérifie la connexion */
if (mysqli_connect_errno()) {
    
printf("Échec de la connexion : %s\n"mysqli_connect_error());
    exit();
}

if (
$stmt mysqli_prepare($link"SELECT Name FROM Country WHERE Name=? OR Code=?")) {

    
$marker mysqli_stmt_param_count($stmt);
    
printf("La requête a %d variables.\n"$marker);

    
/* Fermeture de la commande */
    
mysqli_stmt_close($stmt);
}

/* Fermeture de la connexion */
mysqli_close($link);
?>

L'exemple ci-dessus va afficher :

La requête a 2 variables.

Voir aussi



add a note add a note User Contributed Notes
mysqli_stmt->param_count
There are no user contributed notes for this page.

mysqli_stmt::prepare> <mysqli_stmt::num_rows
Last updated: Fri, 05 Dec 2008
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites