The following code will create a series of tabbed sections on a single page. Each tabbed section will have a series of boxes that contain […]
Validate UK Postcode
The following script will take the input from the form and validate a post code in UK Format eg. Lettter Letter Number Number Letter Letter […]
RegEx To Replace Empty Tags with just IDs Using Notepad++
Here is an example html output from a DOCX file imported into WordPress (in this case with the Mammoth docx converter plugin): <h2><a id=”post-44034-_7ttglipb267h”></a>Header Text</h2> […]
Remove First Character From A Field In A Database
Assuming we have the following entry in our database: /go/123456 But we require: go/123456 UPDATE `TABLENAME` SET `FIELDNAME` = SUBSTRING(`FIELDNAME`, 2) WHERE `FIELDNAME` LIKE `/%`;
Replace String In Database Field
The following code will replace a string in a database field UPDATE `TableName` SET `DatabaseField` = REPLACE(`DatabaseField`, ‘OldString’, ‘NewString’) WHERE `DatabaseField` LIKE ‘%OldString%’;
Simple PHP Mailer Function
Send an email with PHP – useful for a simple contact form if (isset($_POST[‘submit’])) // Your submit button or a required form field { $EmailTo […]
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 […]
Split A Large MySQL Table Into Multiple SQL Files
If you have a large database table that is causing your import to fail, you can split the table out into smaller more manageable chunks […]
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 […]