Adblock breaks this site

Help with creating a table in php

Discussion in 'Web Programming' started by TheKnight01, Dec 17, 2009.

  1. TheKnight01

    TheKnight01 Newcomer

    Joined:
    Dec 16, 2009
    Posts:
    2
    Referrals:
    0
    Sythe Gold:
    0
    Help with creating a table in php

    I was wondering if anyone can give me advice or point me to the right direction on how to code a table that can be edited via a registered user.
    For example, if the columns were "Rank", "Name", "Total"

    "Rank" is a positive real number(1,2,3..)
    "Name" is just a name a user has added to the table
    "Total" is also a positive real number which a registered user can edit by selecting the name then changing the value/number

    I'm also thinking of having this table arrange the list of names depending on the column "Total". So if Name Three has more total than Name Two, then name three should be automatically ahead of name two in the table.

    Finally i want this list published on an html page that can be viewed by anyone.

    Sorry if i make it sound complicated but i really hope you get the idea. Can you help me with getting started please?
     
  2. Deacon Frost

    Deacon Frost Grand Master
    Banned

    Joined:
    Jan 30, 2007
    Posts:
    2,905
    Referrals:
    3
    Sythe Gold:
    57
    Help with creating a table in php

    Very well, I'll update this post with the finished snippet.

     
  3. TheKnight01

    TheKnight01 Newcomer

    Joined:
    Dec 16, 2009
    Posts:
    2
    Referrals:
    0
    Sythe Gold:
    0
    Help with creating a table in php

    Thanks alot Deacon!:) Last question, how can i make the column rank automatically output numbers to the column? Because in the output screen, this is what i get:

    Rank Name Total
    2 Name Two 10
    1 Name One 5

    It did what i wanted(arrange the list according to column Total, but it also moves the value in Rank.

    This is how i want it to look like:
    Rank Name Total
    1 Name Two 10
    2 Name One 5

    Let's say i want 50 rows, which is 50 numbers, so i want column Rank to print 1-50, and leave them unchanged as the list changes order according to column Total.
     
  4. Deacon Frost

    Deacon Frost Grand Master
    Banned

    Joined:
    Jan 30, 2007
    Posts:
    2,905
    Referrals:
    3
    Sythe Gold:
    57
    Help with creating a table in php

    I updated the code with some links and a few extra variables to make it a bit more dynamic.

    Now, you can click the text "Rank" or "Total" to sort by asc, or desc. :)
     
< Need help this is prob easy! | Falling Snowflakes with images >


 
 
Adblock breaks this site