Image Manipulation When uploading images this handy PHP extension will allow you to manipulate images on the fly – resizing, renaming, change format and even add effects. PHP Image Magician PDF Generation Generate PDF’s on the fly based on the content of your MySQL database. TCPDF Excel Generation Generate Excel files on the fly based…
Read MoreAs part of the range of new HTML5 Javascript goodies localStorage allows developers to store data client side for later reuse. Sounds familiar? Yep, just like cookies, but without the size limitations as you can store Megabytes of data using localStorage. Setting Values To set a localStorage value you use the method setItem(). localStorage.setItem(name,value); So…
Read MoreThe CSS float property is often used to create columns. Waiting in the wings are some newer techniques such as the CSS column-count property which will make adding columns much easier. For example given a HTML snippet of : We can use the following CSS to put the list into 5 nice columns. View Demo…
Read MoreSmart curly quotes are the bane of my life and they most commonly cause grieve when users cut and paste from Microsoft Word into a web form and you end up with the funny box shapes. This code was on toao.net and I’ve just added it to a function. Original found here: http://www.toao.net/48-replacing-smart-quotes-and-em-dashes-in-mysql
Read MoreGiven a true path of: PHP Output Notes $_SERVER[‘DOCUMENT_ROOT’]; /var/www true document root $_SERVER[‘HTTP_HOST’] www.mustbebuilt.co.uk Host name $_SERVER[‘PHP_SELF’] /stuff/more/file.php Path of current file So combining $_SERVER[‘HTTP_HOST’] with $_SERVER[‘PHP_SELF’] would get the full path to the file ie: PHP Output $_SERVER[‘HTTP_HOST’].$_SERVER[‘PHP_SELF’]; www.mustbebuilt.co.uk/stuff/more/file.php The pathinfo() method can then be used to return an associate array of useful…
Read MoreQuick tip post. If you have set your data in MySQL to be utf-8 and have special characters such as umlauts (ö) and accents (é) then ensure you add the following: This could be added to your connection information as follows: This sets the character set used in the msqli method to utf8. If this isn’t…
Read MoreWhen you have a database make it work for you. This example shows how to use a database to create a simple HTML drop down list. Assume we have a table such as: Film Name Film Certificate Tropic Thunder 15 TRON: Legacy PG Inception 12 The Tourist 12 The Shawshank Redemption 15 The Usual Suspects…
Read MoreInserting multiple values with a prepare statement can be a little tedious. This solution uses PDO rather than mysqli as you can loop around the bindValue statement. The code also assumes a table structure where the first field is an auto-increment thus the loop is pushed on one so as to ignore this field. You…
Read MoreTernary The ternary operator makes for a shorthand if … else condition : if true do this ? else to this For example the following if … else: … can be done with the ternary operator with: JSFIDDLE Demo Waltzing (m)tilde ~ The little used tilde character ~ is a bitwise operator that works right…
Read MoreJavascript functions can be written in a number of different ways. Function declarations Firstly we have the ‘classic’ named function: This technique is known as a ‘function declaration’. JSFIDDLE Demo Function Expressions Then we have the anonymous function: The above function has no name and is associated with an event. This technique is a type…
Read More