Welcome Guest, Not a member yet? Register   Sign In
How can setup this mysql databse for my 1st project in CI?
#4

[eluser]phantom-a[/eluser]
[quote author="Tanque" date="1220741465"]it's great you had found out how to do it... can u xplain it here?...[/quote]


I'm not sure to how to explain the table. But it only requires one table.
I put several fields including the first one as "id" autoincrement, Int(11)
then a category int(10), then a table "url" that is varchar that was is it. (For basics)
I've added more


With a simple SELECT statment I can select the "url" from only the right category and then display them on the category page.

So for example I create a category called "cgiproxies" which lists cgi powered proxies.
I assigned this category as "1" in the category sql field

Then I create the cgiproxy page and put into the maincontroller


Code:
function cgi_proxies()
    {  

        $data['query'] = $this->db->query('SELECT `url`,`id`,`date`,`hits` FROM `links` WHERE `category`=1 ORDER BY datestamp');

        $this->load->view('cgi_proxies', $data);


That SQL query will only select the rows that have category 1 and thus display only the urls of the "Cgiproxies" on that page. I hope that made sense? I don't know how I got that. lol I' m not a programmer. But that video tutorial on creating a blog in 20 minutes was a huge help. Then I just put into the cgiproxy category page the phpforeach loop and and loop threw all the entries of that category query..

Now I to create a pagination, Because I don't want them all on the same page, only about 20 urls per page,.. I'm not sure how to this?


Messages In This Thread
How can setup this mysql databse for my 1st project in CI? - by El Forum - 09-06-2008, 12:12 PM



Theme © iAndrew 2016 - Forum software by © MyBB