Help with creating a table in php

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

Help with creating a table in php
  1. Unread #1 - Dec 17, 2009 at 12:35 AM
  2. TheKnight01
    Joined:
    Dec 16, 2009
    Posts:
    2
    Referrals:
    0
    Sythe Gold:
    0

    TheKnight01 Newcomer

    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?
     
  3. Unread #2 - Dec 17, 2009 at 12:39 AM
  4. Deacon Frost
    Joined:
    Jan 30, 2007
    Posts:
    2,905
    Referrals:
    3
    Sythe Gold:
    57

    Deacon Frost Grand Master
    Banned

    Help with creating a table in php

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

     
  5. Unread #3 - Dec 17, 2009 at 11:36 AM
  6. TheKnight01
    Joined:
    Dec 16, 2009
    Posts:
    2
    Referrals:
    0
    Sythe Gold:
    0

    TheKnight01 Newcomer

    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.
     
  7. Unread #4 - Dec 17, 2009 at 12:13 PM
  8. Deacon Frost
    Joined:
    Jan 30, 2007
    Posts:
    2,905
    Referrals:
    3
    Sythe Gold:
    57

    Deacon Frost Grand Master
    Banned

    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 >

Users viewing this thread
1 guest


 
 
Adblock breaks this site