Error on large MySQL imports on a WAMP stack…

Error: [text]Got a packet bigger than ‘max_allowed_packet’ bytes[/text] Fix: 1. Open my.ini from your MySQL installation directory, add this line to the [mysqld] section: [text]max_allowed_packet = 100M[/text] (The value (100M) is arbitrary – use whatever.) 2. Restart MySQL (easiest way IMO is Start > Control Panel > Administrative Tools > Services… right-click ‘mysql’ service and […]

MySQL – get random row

MySQL – get next / previous record

assuming you’re using an auto-incremented PK called ‘id’, compared to a bound param ‘:id’ which represents the current record… next:

previous:

Getting Progress (bytesLoaded, bytesTotal) from dynamic XML

Seldom do I use straight XML files anymore; they always seem to be generated from dynamic content, often from PHP running through a DB table.  By dynamically generating the XML file, the system has no way of knowing the size of the final output, so ProgressEvent.PROGRESS listeners will silently fail.  It’s easy enough to remedy […]

MySQL – find longest string in column

this comes in handy with surprising frequency get the length of the longest string in a column

select the longest string in a column

MySQL – Find and Replace in Table

the where clause isn’t technically necessary, but i’d guess it’d be more efficient (not tested). an example without illustrative characters: