architecture

PHP 5 and MySQL 5 Stored Procedures Error and Solution with Qcodo

I've been working on a re-architecture of a project and I've been experimenting with using MySQL Stored Procedures for some of my business level logic. I'm using PHP 5.2.0, PHP's MySQLi Extension and MySQL 5.0, so stored procedures are new, but stable.

I also make use of the Qcodo ORM framework. Qcodo has support for both of the MySQL API's; Original Mysql and Mysqli. I created my first Stored Procedure using the following code:  read more »

How I build an application - Part 4 - Use Cases

This article the 4th installment in of a series titled 'How I build an application'. You can find the other two installments and subsection here.

I've written about my Idea, but before I get into the code, I need to flesh out how the idea is translated into a usable application a bit more. When I come up with an idea, I have a general page flow diagram in my head. Translating that in-memory page flow into code is generally straightforward, and most of the time I can simply sit down and code it.

For the use of this article, that brain dump process is hard to explain. The purpose of this article is to explain that process. Without further ado, here's my page flow diagram created in Microsoft Visio using their Use Case template set.  read more »

How I build an application - Part 3 - The Tables

This article the 3rd installment in of a series titled 'How I build an application'. You can find the other two installments and subsection here.

I mentioned last time that I would discuss why I choose certain data types for certain fields.

Recipe Ingredient Table

--
-- Table structure for table `recipe_ingredient`
--

CREATE TABLE IF NOT EXISTS `recipe_ingredient` (
  `recipe_ingredient_id` int(10) unsigned NOT NULL auto_increment,
  `recipe_id` int(10) unsigned NOT NULL default '0',
  `unit_id` int(10) unsigned NOT NULL default '0',
  `ingredient_id` int(10) unsigned NOT NULL default '0',
  `unit_amount` tinyint(3) NOT NULL default '0',
  PRIMARY KEY  (`recipe_ingredient_id`),
  KEY `IDX_recipe_ingredient_recipe_id` (`recipe_id`),
  KEY `IDX_recipe_ingredient_unit_id` (`unit_id`),
  KEY `IDX_recipe_ingredient_ingredient_id` (`ingredient_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

This table is one that ties a lot together, so we'll start here. This table contains a primary key and three foreign keys. I try to always construct my integer keys using a display length of 10, marking them unsigned with a default of zero. Whether a field is marked at 'NULL' or 'NOT NULL' depends on the design.  read more »

How I build an application - Part 2 - The Database

Onto the next stage. I've got my vision nailed, now it's time to start building.

This article is a continuation of How I build an application - Part 1. Check it out if you missed it. Last time, I came up with the idea of a little tool to help plan meals with the goal of eating healthier and spending grocery money more efficiently. I came up with the following drawing for my database.

 read more »

How I build an application - Part 1, Subsection A

Thanks for the feedback on the first part of 'How I build an application' that I published two days ago.

The day after writing that post, I had a meeting with a client and I am starting an addon to an existing application for them. During the meeting, which lasted about 2 and 1/2 hours, I thought about what I had written the previous night. Here I was spending time laying out details of a business process with a client, discussing pro's and con's, when I had just written that I mostly guess at this stuff!

Well, I figured I should come clean. It took me another 48 hours to figure out that I really was still guessing. The meeting really came down to discussing the business process, or The Vision rather then the actual implementation of the project. In fact, because I know this client pretty well after working with them for over 2 years, they don't really care about the implementation.  read more »

How I build an application - Part 1

Every few months I get an idea for a neat little application I'd like to have. If somebody hasn't built it yet, I usually take a crack at it in my spare time.

This time around, I found I need a tool to help me plan a weekly menu. I figured it would be cool to blog about it, so here you go. I'll try to describe the steps I move through from start to finish.

The Problem
Being busy and working a lot, I tend to eat a lot of junk. However, cooking is tough. There's the problem of figuring out what I want to eat, the shopping, preparation and finally cooking before I get to the good part, the eating. I want to make that easier. I find the planning part the most time consuming and difficult, so that's where I am focusing.  read more »