PHP MySQL Functions - dummies

By Steve Suehring, Janet Valade

Part of PHP, MySQL, JavaScript & HTML5 All-in-One For Dummies Cheat Sheet

The PHP language provides functions that make communicating with MySQL extremely simple. You use PHP functions to send SQL queries to the database. You don’t need to know the details of communicating with MySQL; PHP handles the details. You only need to know the SQL queries and how to use the PHP functions. Here are some common functions related to PHP and MySQL.

Function Description
mysqli_connect(host,accnt,passwd,dbname) Connects to a MySQL database.
mysqli_query($cxn,query) Sends a query to a MySQL database.
mysqli_fetch_assoc($result) Retrieves an array of data from a query.
mysqli_num_rows($result) Returns the number of rows from the previous query.
mysqli_insert_id($cxn) Retrieves the last inserted ID for an INSERT statement.