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… [Read more…]
…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… [Read more…]
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.… [Read more…]
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… [Read more…]
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…
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 a… [Read more…]
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… [Read more…]
When using the InnoDB table format in MySql, there’s the possibility to define foreign key relations to guarantee referential integrity. Setting up the relations by using “ALTER TABLE” sql statements is not that trivial though. I had some struggles the other day… Luckily there’s a view in PhpMyAdmin that takes care of this. Check out… [Read more…]
October 24, 2009
2