Archive for March 2nd, 2009

The Millimetre Crisis in Hoodwinked Kingdom

The Great Big Millimetre Crisis in Hoodwinked Kingdom. by Christopher Brooks

It came about that a whole kingdom was cast
over by a spell from a tiny sect in it’s territory
that from this day forth all “millimetres” belong and are
controlled in supply by their new “mm” bank.

This sect grew in power and found many clever
ways to manipulate and pervert the “mm” from
it’s genuine honest scientific function as a stable
medium of exchange.

The sect grew it’s influence by supporting
the Hocus Pokus University to research
the scarcity of “mm” theory and the
Spellmaker Press always published
the “Coping with limited “mm” stress”
reports. Read the rest of this entry »

Popularity: 4% [?]

,

3 Comments

htmlspecialchars for mysql

Yes, it’s bad, evil, nasty, and just plain wrong.

But that doesn’t mean that there aren’t occasions when you do need to spew out html directly from mysql (or at least I’ve found one).

DELIMITER $$

DROP FUNCTION IF EXISTS `htmlspecialchars`$$
CREATE FUNCTION `htmlspecialchars` (_str text) RETURNS text
BEGIN
	set _str = replace(_str, '"', '"');
	set _str = replace(_str, '&', '&');
	set _str = replace(_str, '<', '&lt;');
	set _str = replace(_str, '>', '&gt;');
	return _str;
END$$

DELIMITER ;

Usual disclaimers apply.

Popularity: 4% [?]

,

No Comments