If you just want to grab one record, or know that you are only expecting one result you can use the following code: <?php // […]
Loop Through Recordset With MySQL and PHP (MYSQLI Connection)
This is the basic syntax required to loop through a MySQL table and output the results <?php // Connect to your database $conn = mysqli_connect(“localhost”, […]
ON DELETE Cascade (Remove child records when parent records deleted)
If you haven’t created the child table you can run the following SQL command: CREATE TABLE ChildTable ( ChildID INT PRIMARY KEY AUTO_INCREMENT, ParentID INT, […]
Loop Through MySQL Fields And Output A Form
This script will loop though all fields in a database and output the name and create a form field with appropriate record value. This is […]
Rename SQL Table
If you wish to rename a SQL table use the following code: ALTER TABLE table_name RENAME TO new_table_name;
Add an Index to a MySQL Table
An index speeds up the serving of data by allowing you to quickly find data in a table without having to go row by row […]
Copy MYSQL Table Structure and Import Specific Columns
This code will allow you to copy the table structure from an existing table into a new one and then copy data from specific columns […]
Change Image Filenames In MYSQL (jpg to png)
Create a script (replacing the variables as necessary) and run it to replace ALL instances of (in this case) “star.jpg” to “star.png” <?php // CHANGE […]