Creating a dynamic table based on a simple mysql table

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Ctech
Forum Newbie
Posts: 4
Joined: Wed Jun 25, 2008 1:54 pm

Creating a dynamic table based on a simple mysql table

Post by Ctech »

Hi guys,

This is my first post on the forum. I've so far tried and tried to get my codes to work myself, and I normally do after some time.. however I probably make them very complicated for no special reason. So thought I'll try you guys for some help and examples this time..

Short what i am doing. I've inputted my google ranking for certain keywords and domains in a table that is stored in a mysql db. I now want to use php to display this is a table or a floating divs ( I guess that is my two options), to create a dynamic table. With that I mean you can decide to sort by any of the columns.

I've created a mockup in Excel of what I am trying to achieve. The picture also shows the mysql table.(see attachment)

----
MySQL table:

Name: GoogleRanking
id - int
domain - varchar
keyword - varchar
ranking - varchar
date - timestamp

-----
current - 1 week = last weeks data.
I want 10 columns showing the last 10 weeks of ranking result

Important: 1 is the highest, lowest ranking is 50.

Can anyone help me with this?
Attachments
Picture 10.png
Picture 10.png (22.38 KiB) Viewed 178 times
User avatar
Zoxive
Forum Regular
Posts: 974
Joined: Fri Apr 01, 2005 4:37 pm
Location: Bay City, Michigan

Re: Creating a dynamic table based on a simple mysql table

Post by Zoxive »

It is a simple table.. but getting what you want is not so simple.

If it were me, I would do a whole table redesign and have multiple tables.
But back to your question/problem.

This little project is going to require quite a bit of query's just thinking it over in my head. Because with the data, you are generating New data, which is generating New data, and then you are sorting the final result. And there are sometimes where its new data->new data a few times, or just once. I am talking about when you are generating last weeks rank, and then comparing it to this weeks rank, which makes the difference between the two.

We can certainly help you with your existing code/or code theory, but we will not be writing code for you.
Ctech
Forum Newbie
Posts: 4
Joined: Wed Jun 25, 2008 1:54 pm

Re: Creating a dynamic table based on a simple mysql table

Post by Ctech »

I am not expecting anyone to write my code. So I am sorry if the way I wrote the post made it look like that.


I hear you say that it might help to change the layout of my mysql tables:

Something like this?

Table 1: domain
Name: domain.no

Table2: Keyword
Name Keyword:

Table3: Ranking
Id: Auto Int
Name: domain.no (from tbl 1)
Name: Keyword (from tbl 2)
Ranking: numb
Date: Timestamp or date ( Need only data pr day and not hours)


Would something like this make it easier?
Post Reply