diff --git a/reference/mysqli/mysqli_stmt/execute.xml b/reference/mysqli/mysqli_stmt/execute.xml index e08d28e133..bc45e7b3e0 100644 --- a/reference/mysqli/mysqli_stmt/execute.xml +++ b/reference/mysqli/mysqli_stmt/execute.xml @@ -12,12 +12,13 @@ &style.oop; public boolmysqli_stmt::execute - + arraynullparams&null; &style.procedural; boolmysqli_stmt_execute mysqli_stmtstatement + arraynullparams&null; Executes previously prepared statement. The statement must be successfully @@ -42,6 +43,14 @@ &mysqli.stmt.description; + + params + + + An optional list &array; with as many elements as there are bound parameters in the SQL statement being executed. Each value is treated as a &string;. + + + @@ -53,10 +62,32 @@ + + &reftitle.changelog; + + + + + &Version; + &Description; + + + + + 8.1.0 + + The optional params parameter has been added. + + + + + + + &reftitle.examples; - <methodname>mysqli_stmt::execute</methodname> example + Execute a prepared statement with bound variables &style.oop; + + + + Execute a prepared statement with an array of values + &style.oop; + +query('CREATE TEMPORARY TABLE myCity LIKE City'); + +/* Prepare an insert statement */ +$stmt = $mysqli->prepare('INSERT INTO myCity (Name, CountryCode, District) VALUES (?,?,?)'); + +/* Execute the statement */ +$stmt->execute(['Stuttgart', 'DEU', 'Baden-Wuerttemberg']); + +/* Retrieve all rows from myCity */ +$query = 'SELECT Name, CountryCode, District FROM myCity'; +$result = $mysqli->query($query); +while ($row = $result->fetch_row()) { + printf("%s (%s,%s)\n", $row[0], $row[1], $row[2]); +} +]]> + + &style.procedural; + + + + &examples.outputs; + +