PHP Function Reference

PHP mysqli_stmt __construct() Method



The PHP mysqli_stmt::__construct() method is used to construct a new mysqli_stmt object.

Syntax

public mysqli_stmt::__construct(mysql, query)

Parameters

mysql Required. Specify a mysqli object.
query Optional. Specify the query, as a string. If this parameter is null, then the constructor behaves identically to mysqli_stmt_init(), otherwise it behaves as per mysqli_prepare().

Note: In general, you should use either mysqli_prepare() or mysqli_stmt_init() to create a mysqli_stmt object, rather than directly instantiating the object with new mysqli_stmt.

❮ PHP MySQLi Reference