Web & Software Developer

Posts Tagged “mysqli”

PHP – Check if INDEX or KEY Exists in MySQL Table

Here are some PHP functions to check if an INDEX exists in a MySQL table. Here is also a function that adds a new INDEX to a table. The first function lets you check for a specific INDEX (or KEY). The second function lists all indexes of a table, with their Key_name and Column_name. The … Read more →

PHP – Count Rows in MySQL Database Table

This is a quick PHP function to count rows in a MySQL database table. It takes 2 parameters, which are: $link This is the MySQL connection object which is made, for example, by using mysqli_connect() or mysqli_init(). $table The name of the table that you want to count rows for. The function will a return … Read more →

MYSQLI DELETE Prepared Statement

This is how to make a PHP mysqli DELETE query with a prepared statement. This example includes error checking at every step. Error checking will help you debug your prepared mysqli query when it’s failing and you don’t know why. You can use this example to help you debug any mysqli prepared statement, not only … Read more →

Insert Data Array Into MySQL Table Using PHP

Updated to use MySQL transactions, prepared SQL statments, and bound parameters. This lets you insert data from a PHP array into your MySQL database table. It will insert multiple rows into the table, where each row will take values from one array element. Before inserting, you must prepare your data into an array consisting of … Read more →