mysqli_stmt_param_count
(PHP 5)
mysqli_stmt_param_count
(no version information, might be only in CVS)
stmt->param_count -- Retourne le nombre de paramètres d'une commande MySQL
Description
Style procédural
int
mysqli_stmt_param_count ( mysqli_stmt stmt )
Style orienté objet (méthode)
class
mysqli_stmt {
int param_count
}
mysqli_stmt_param_count() retourne le nombre de
variables attendues dans la requête préparée stmt.
Valeurs de retour
Retourne un entier représentant le nombre de paramètres.
Exemples
Exemple 1. Style orienté objet |
<?php
$mysqli = new mysqli("localhost", "utilisateur", "mot_de_passe", "base");
if (mysqli_connect_errno()) {
printf("Connexion échouée : %s\n", mysqli_connect_error());
exit();
}
if ($stmt = $mysqli->prepare("SELECT Nom FROM Pays WHERE Name=? OR Code=?")) {
$marker = $stmt->param_count;
printf("La requête a %d variables.\n", $marker);
$stmt->close();
}
$mysqli->close();
?>
|
|
Exemple 2. Style procédural |
<?php
$link = mysqli_connect("localhost", "utilisateur", "mot_de_passe", "base");
if (mysqli_connect_errno()) {
printf("Connexion échouée : %s\n", mysqli_connect_error());
exit();
}
if ($stmt = mysqli_prepare($link, "SELECT Nom FROM Pays WHERE Name=? OR Code=?")) {
$marker = mysqli_stmt_param_count($stmt);
printf("La requête a %d variables.\n", $marker);
mysqli_stmt_close($stmt);
}
mysqli_close($link);
?>
|
|
L'exemple ci-dessus va afficher :
La requête a 2 variables. |