Web & Software Developer

Posts Tagged “SQL queries”

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 →

MySQL Command Line Cheat Sheet

These are my most often-used MySQL commands and queries. Connect to MySQL on the command line (replace USERNAME with your own): (You will then be prompted to enter your MySQL password.) MySQL Databases List all databases on the command line: Create a database on the command line: Replace database_name, above, with your name of choice. … Read more →

Add a Field to Existing MySQL Table

Insert a field or column right after some existing field in an existing table in a MySQL database. Replace ‘feildname’ with the new field name which you want to add. Replace ‘existingfield’ with your existing field name (the new field will be inserted after this existing field).