What function do you use in PHP to execute a query against a MySQL database?

  • mysqli_query()
  • mysql_query()
  • pdo_query()
  • execute_query()
In PHP, you can use the mysqli_query() function to execute a query against a MySQL database. This function takes two parameters: the connection object and the SQL query you want to execute. The SQL query can be any valid MySQL statement, such as SELECT, INSERT, UPDATE, or DELETE. The mysqli_query() function returns a result object for successful SELECT queries or a boolean value for other types of queries. It's important to use prepared statements or proper escaping techniques to prevent SQL injection vulnerabilities when executing user-supplied data as part of the query.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *