What are the differences in syntax between mysqli_query and mysql_query functions in PHP?

The main difference in syntax between mysqli_query and mysql_query functions in PHP is that mysqli_query requires a database connection object as the first parameter, while mysql_query does not require this parameter. Additionally, mysqli_query supports prepared statements and bound parameters for secure database operations, which mysql_query does not support. It is recommended to use mysqli_query for new projects as mysql_query is deprecated as of PHP 5.5.0.

// Using mysqli_query function
$connection = mysqli_connect("localhost", "username", "password", "database");
$query = "SELECT * FROM table";
$result = mysqli_query($connection, $query);

// Using mysql_query function (deprecated)
$query = "SELECT * FROM table";
$result = mysql_query($query);