MySQL and PHP

5.27.17 Session::sql

Copyright 1997-2021 the PHP Documentation Group.

Description

public mysql_xdevapi\SqlStatement mysql_xdevapi\Session::sql(string query);

Create a native SQL statement. Placeholders are supported using the native "?" syntax. Use the execute method to execute the SQL statement.

Parameters

query

SQL statement to execute.

Return Values

An SqlStatement object.

Examples

Example 5.127 mysql_xdevapi\Session::sql example

<?php
$session = mysql_xdevapi\getSession("mysqlx://user:password@localhost");

$session->sql("CREATE DATABASE addressbook")->execute();
?>