You are here

June 2010

(mdb to) csv to MySQL

Quick and dirty PHP script to turn a CSV file into a table in a MySQL database. Used for a Drupal project, so I ran it with drush php-script. Couldn't find anything better online. Feel free to use it.

If I need it again some time I will probably make it a bit nicer (I might also make it nicer if you ask me nicely and/or pay me to do it).

In the project I'm using it, I first converted an .mdb file to .csv with mdbtools.

<

pre>
<?php

$handle = fopen("/tmp/test.csv", "r");
$headers = fgetcsv($handle);

Rewrite Rules (not) - Lowercase URLs, but only for some specific paths

This took me enough time to get right to post a little blog post about it:

        RewriteEngine on
        RewriteMap lc int:tolower
        RewriteCond %{REQUEST_URI} (shared|Shared|download|Download)/[A-Z]
        RewriteRule (.*) ${lc:$1} [R=301,L]

Note that this doesn't work in .htaccess - you have to put it higher up in the Apache configuration.

Hosting Rank a Brand

Rank a Brand is a website for consumers to compare transparency, greenness and fairness of popular brands. By buying the brands with the best rankings you can help creating a better world. The more people will be doing this, the bigger the incentive for companies to be transparent, green and fair.

Pages