MySQL makes stuff easy 2

Jul 6th, 2009 Posted in MySQL | no comment »

How to convert old html-symbols to utf-8 automatically in MySQL?

i did it with REPLACE():

UPDATE `articles` SET `title` = replace(`title`,'ä','ä');
UPDATE `articles` SET `title` = replace(`title`,'ö','ö');
UPDATE `articles` SET `title` = replace(`title`,'ü','ü');

… worked with all my old tables :)

PHP SQLite3 support

Jul 4th, 2009 Posted in PHP, SQL | no comment »

I never before noticed the SQLite3 class in PHP. Until now.

OK … so what can you use sqlite for? Let’s assume you are developing a database driven app. Wouldn’t it be nice to not have to set up a mysql server on your laptop to be able to code on localhost whereever you are?

With SQLite you only need one *.db file and your ready to run!

$database = new SQLite3('test.db');

That’s all it takes to make a new SQLite object in PHP.

The SQLite code is actually verry similar to MySQLi object code. I like it. Hopefully you do to ;)

[UPDATE] the link project

Jul 1st, 2009 Posted in Uncategorized | no comment »

UPDATE: due to personal reasons the link project site will not launch on Jul 10. :(

MySQL makes stuff easy

Jul 1st, 2009 Posted in MySQL | no comment »

Recently, had to

MIGRATE `some`, `product`, `tables` FROM `different sources` WHERE `someone apparently typed letters in fields that were supposed to hold numbers only`;

Only problem: the table holds nearly 3000 rows.

So I used a regular expression:

SELECT * FROM `products` WHERE `price` REGEXP '[:alnum:]';

It took 0.0434 sec for MySQL to identify the badboys ;)

the link project

Jun 25th, 2009 Posted in PHP | no comment »

A while back I had a problem with some link-organizing-sites.

So I made a list of things that I thought would be necessary:

  • CRUD
  • fast site
  • statistics
  • lookup service
  • user accounts
  • easy interface

There are a few services out there that are great but I wanted to have something better.

Approximately 2 weeks ago I started to work on my own link service.

The goal is to make a site that has all the necessary things and is also very extend-able, reliable and brings in new innovations.

I hope to launch the site for official beta testing on Jul 10.

Domain lock in J1.5.11

Jun 25th, 2009 Posted in CMS, PHP | no comment »

Once I had to force J1.5.11 to use a specific domain and here is how i’ve done it:

  1. I browsed to /libraries/joomla/environment
  2. I opened uri.php in gedit
  3. finally I replaced all $_SERVER['HTTP_HOST'] with “www.???.com”

i know it’s not good programming.

in fact it’s horrible but it worked for me :)