Browsing All Posts filed under »Database«

MySql: The power of Views (or Better late than never)

October 24, 2009

2

I sometimes get the sour feeling of “there’s something fundamentally wrong with this! It works, but nevertheless…” It happens in all aspects of life, including programming. Some of (not always!) the times this feeling causes curiosity and energy to strive for a new perspective, new knowledge, new ways of facing the problem. Aspects of inutition […]

The quest for client-side search query language

September 25, 2009

0

…just led me to CQL (Contextual Query Language). Thanks StackOverflow and njk for showing the way! (Please note that since version 1.2, “Contextual Query Language” is changed from former “Common Query Language”) This lets the user write advanced searches using logical operators, indexes, even proximities… So, let’s create a search for all the cql-to-php-to-sql libraries […]

Kohana, Formo and many-to-many relations (“habtm”)

September 18, 2009

0

Just got the solution for how to handle many-to-many relations in Formo. Thank you, Ben! Three tables, groups (id, name), users (id, name) and the pivot table groups_users(group_id, user_id). And here’s how to in the controller handle display of an user form, complete with checkbuttons for toggling connections to groups: This gives the following form. […]

Kohana PHP with ORM and Formo – db made easy!

September 17, 2009

1

After some days prototyping with Kohana, I start to realize the strength and beauty! One of the every-day needs in my world is to coordinate different database tables to get things to work. Most of the time this is done by hand, using PhpMyAdmin. For basic stuff, this works fine, but very often there’s the […]

Happy crudding with Kohana

September 16, 2009

0

Another superb Kohana solution: CRUD Scaffold (projects.nathanbentley.com/projects/show/crudscaffold) by Nathan Bentley. Just install, write some controller and model lines, and you have a nice JQuery-driven table editor – just the way it should be!: Thank you, Nathan! Now, there’s just left to sort out how to handle related tables…

Php: Getting it together with Kohana?

September 16, 2009

0

Somewhere deep inside you carry a vision, a longing, a vague picture of “getting it all together”… At least I do – in every aspect of life..! 🙂 Since I started php coding some years ago, I’ve always had a bad taste in my mouth. It’s so ugly, so diversitive, so sprawling, so poly-cultural (in […]

Foreign key relations in MySql – Avoiding accidental deletion of posts

July 7, 2009

1

The normal case when using foreign key relationships in database tables might be “ON DELETE CASCADE ON UPDATE CASCADE”. If you have a table connecting a user_id to an activity_id, this means that deleting the activity post also deletes the connection post. Fine! The activity is gone, and so the table post defining the connection […]