Archive for the ‘Uncategorized’ Category

DPM Once

Posted on: February 11th, 2014 by admin No Comments

dpm is a function provided by the devel module that allows you to inspect objects and arrays in Drupal’s message area. Sometime I want to inspect something in a loop, but I only want to inspect the element once, not in every iteration of the loop. Especially it it is going to loop lots of […]

Drupal Form with dynamically adding a collection of fields via ajax

Posted on: October 25th, 2013 by admin No Comments

I put this together by combining a couple of different examples from the examples module but wanted to keep it here for future reference. This example shows a holiday form where each holiday has a start date, end date and number of days field, and there can be multiple holidays. 1. Set up the page: […]

Select MySQL Timestamp at start or end of day or week

Posted on: October 16th, 2013 by admin 1 Comment

Code to select MySQL timestamp at the start, or beginning of the day. SELECT UNIX_TIMESTAMP(DATE_FORMAT(NOW(),"%Y-%m-%d 00:00:00"))SELECT UNIX_TIMESTAMP(DATE_FORMAT(NOW(),"%Y-%m-%d 00:00:00")) And for a timestamp at the end of the day: SELECT UNIX_TIMESTAMP(DATE_FORMAT(NOW(),"%Y-%m-%d 23:59:59"))SELECT UNIX_TIMESTAMP(DATE_FORMAT(NOW(),"%Y-%m-%d 23:59:59")) Timestamp for the beginning of the week (Monday morning): SELECT UNIX_TIMESTAMP(DATE_FORMAT(DATE_SUB(CURDATE(), INTERVAL WEEKDAY(CURDATE()) day), "%Y-%m-%d 00:00:00"))SELECT UNIX_TIMESTAMP(DATE_FORMAT(DATE_SUB(CURDATE(), INTERVAL WEEKDAY(CURDATE()) day), "%Y-%m-%d 00:00:00")) […]

Suzuki Supercarry

Posted on: June 8th, 2013 by admin No Comments

I’m selling my van as I now have a smart car. Will miss this van – has been great fun. This van could be yours for £1200. Here are some pics…