mysqli::real_query

mysqli_real_query

(PHP 5, PHP 7, PHP 8)

mysqli::real_query -- mysqli_real_query执行一个mysql查询

说明

面向对象风格

public mysqli::real_query(string $query): bool

过程化风格

mysqli_real_query(mysqli $mysql, string $query): bool

对数据库执行单条查询,其结果可以使用 mysqli_store_result()mysqli_use_result() 检索或存储。

警告

Security warning: SQL injection

If the query contains any variable input then parameterized prepared statements should be used instead. Alternatively, the data must be properly formatted and all strings must be escaped using the mysqli_real_escape_string() function.

为了确定给定的查询是否应返回结果集,参阅 mysqli_field_count()

参数

mysql

仅以过程化样式:由 mysqli_connect()mysqli_init() 返回的 mysqli 对象。

query

查询字符串。

返回值

成功时返回 true, 或者在失败时返回 false

错误/异常

If mysqli error reporting is enabled (MYSQLI_REPORT_ERROR) and the requested operation fails, a warning is generated. If, in addition, the mode is set to MYSQLI_REPORT_STRICT, a mysqli_sql_exception is thrown instead.

参见

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top