Welcome Guest, Not a member yet? Register   Sign In
getting started
#1

[eluser]scorche[/eluser]
I just got started with CI today and I have to say I quite like it. (started with Cake, but it didn't quite work for me). I find that above all, it's SIMPLE. My experience has been the simpler something is, the more versatile. (applies to frameworks more than apps)

anyway, I'm also quite new to php and so I might have questions that are php and not CI related.

anyhow, here I go.



I'm trying to do a few things (at once of courseSmile I want to build a simple app to get to know the interaction of database php and CI. So I'm building a simple time management app. Really simple, but maybe not the simplest possible.

I've created some tables in MySql, but I don't know how to create the 1 to Many relations in PHP. I'm guessing I don't really need to anyway as my entries table creates a many to many relationship.

but I have 4 tables
Clients
Projects
Tasks
Entries

So the Client can have multiple Projects, which Can have multiple Task
(at the moment I don't care for one task to be in two Projects but that would be nice too)

I could just populate all the stuff right in the entries, but I'm trying to learn here...

so instead of having the client, project and task name, I want to use their ids in the database, and show the names associated.



so to some of my code
controller:
$data['clients'] = $this->db->get('clients')->result_array();

view:
<? echo form_dropdown('Client', $clients[0]);?>


each array is a row from the table, so obviously $clients[0] doesn't work.

is there a way to grab the columns?

in fact, I'm sure there is a better way of doing this, as I want to use the ID as the data passed and the name shown in the drop down. or is that not the way to go?


Messages In This Thread
getting started - by El Forum - 09-20-2008, 11:05 PM
getting started - by El Forum - 09-20-2008, 11:51 PM
getting started - by El Forum - 09-20-2008, 11:54 PM
getting started - by El Forum - 09-21-2008, 12:00 AM
getting started - by El Forum - 09-21-2008, 12:04 AM
getting started - by El Forum - 09-21-2008, 03:37 AM
getting started - by El Forum - 09-21-2008, 10:41 AM



Theme © iAndrew 2016 - Forum software by © MyBB