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

I wanted to start a project and recently have been taking to learn PHP more serioulsy, having dabbled in it for a few years.

I followed the "Create a blog in 20 minutes" video tutorial with no problems.

For my 1st project I want to just create a Topsite/link indexing script like this site http://www.mylinktrain.com where users can submit a link to a category. Its very simple website. It just takes the submited links and displays them by category with newest first.

What I'm not sure is how to setup the mysql database for such a thing. What would be the table structure for this simple project?

Could anyone here help me? Give me an example of table structure for this? Smile

Nevermind, figured it out. Downloaded some "directory link scripts" and examined there table structure.
So far now my Web App is working! I have created the first category and the page loads only those urls from that category.*tears of joy*. Tongue

I'll make sure to show my site after its done, probably only take a few more hours, because CI takes all the work out of it! Smile

it's great you had found out how to do it... can u xplain it here?...

[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

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?

great code, very easy to understand...

now, regarding pagination... i'm looking about it just right now 'cause i need it to so i can put it in the site i'm creating... it has a list of pdf files to download (later i'll put the code here) and, for now it's easy... there are just 4 reports in it... but what will happen when it has 40 reports?...


I'm reading this, I don't understand it.

Also I can't put demo up yet as I have it on localhost at the moment. Smile

i read it, but i make a mistake... i didn't use models, and when the controller run, i don't have any more items to paginate with... (i don't think i put that right, sorry... but i hope u get it... i speak spanish)... perhaps u find the way to use it...

I don't get how to use it. The pagination works. I tried someone's demo,
here created the model for the page.
But does not work in the manner I wish it. It will just dump the entire table on the page with its field arrays and stuff.
I can't get it too take my SQL qeury
'SELECT `url`,`id`,`date`,`hits` FROM `links` WHERE `category`=1 ORDER BY datestamp'

either then I just get php errors or an empty page.

Theme © iAndrew 2016 - Forum software by © MyBB