Documentation Home
MySQL PHP API
Download this Manual
PDF (US Ltr) - 2.4Mb
PDF (A4) - 2.4Mb
HTML Download (TGZ) - 250.9Kb
HTML Download (Zip) - 258.4Kb


MySQL PHP API  /  ...  /  Session::sql

5.27.17 Session::sql

Copyright 1997-2019 the PHP Documentation Group.

  • Session::sql

    Execute SQL query

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.126 mysql_xdevapi\Session::sql example

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

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