Posted in capacity as Module Leader Group Software Development, Department of Computing Sheffield Hallam University A Morgue One hundred students, 10 clients, 5 labs of University PCs, overzealous Facilities department and the Sheffield weather. What could possibly go wrong? Last week was ‘Scrum Week’. Nineteen groups of students working flat out 9-5, Monday to Friday…
Read MoreOn a recent project I was getting some pages that were causing PHP to run slow. Essentially the PHP was looping through various tables in the MySQL table to build a rather complex ‘Mega Menu’ navigation system. As this navigation system was needed on all the pages of the site this was causing difficultly. The…
Read MoreImage 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 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 MoreAs part of my occasional series on PHP string manipulation here is a quick PHP function designed to retrieve the file extension from a file path. If you get mixed case file extensions ie ‘image1.jpg’ and ‘image2.JPEG’ then use this variant that will return the file extension in lowercase. For others in this series try:…
Read MoreTo demonstrate Objects in PHP I put together a calendar include. View Demo. The calendar was created in a PHP file to use as an include. The code was as follows: This was then included on the page with: And the resultant table was styled up with the following CSS: Now how many days is…
Read More