Web & Software Developer

Page 2 - Code Snippets and Tutorials

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 →

Error Codes For system(“unzip archive.zip”) in PHP

If you’re using system("unzip archive.zip") to unzip an archive file in PHP, and you want to catch errors, you’ll notice that it only returns a number for the error code. Here are the error codes (exit status codes) and meanings for the unzip command. This PHP array matches the unzip error code with its meaning. … Read more →