Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder dniwebdesign's Avatar
    Join Date
    Dec 2003
    Location
    Carrot River, Saskatchewan
    Posts
    846
    Thanks
    15
    Thanked 10 Times in 10 Posts

    Showing table rows?

    Heres the deal. I want to show a list of all the rows in a table. Also I want them to be sorted either by their status, id, the fullname, or the date. All values such as the status, id, fullname, and date are located in a field in each row. When the user clicks the link they are shown the data in the table according to the ID. What would the code be to creat the full list.

    Also is there anyway I could have these in categories (staus) as well? So they can only see the pending ones, hired, not hired, or the trash?
    Dawson Irvine
    CEO - DNI Web Design
    http://www.dniwebdesign.com

  • #2
    Regular Coder
    Join Date
    May 2002
    Location
    Virginia, USA
    Posts
    621
    Thanks
    0
    Thanked 6 Times in 6 Posts
    Dawson, this really is basic. That doesn't mean I won't help you, but simple scripts like this you should be able to find on your own. Try looking in the php manual before posting questions. You may also want to buy a php book, that will teach you how to do stuff like this.

    Rather than type this out, here's a link to a script that does a complete table dump:

    http://codewalkers.com/seecode/20.html

    just do standard queries, using ORDER BY to do the sort. ie:

    "SELECT * FROM tbl_whatever ORDER BY 'status'"

  • #3
    Regular Coder
    Join Date
    May 2002
    Location
    Virginia, USA
    Posts
    621
    Thanks
    0
    Thanked 6 Times in 6 Posts
    the answer to your second question looks like you need to look at how to use SQL.

    I like: W3 Schools

    Check: Their SQL Tutorial and Their PHP Tutorial

    PHP Code:
    ....
    /*
    assume the database is ok, and the user clicked a link 
    that looked like: <a href="http://www.url.com/index.php?status=hired">Hired results</a>
    */

    $status $_GET["status"];
    $sql "SELECT * FROM tbl_whatever WHERE status = '$status'";
    ... 

  • #4
    Regular Coder dniwebdesign's Avatar
    Join Date
    Dec 2003
    Location
    Carrot River, Saskatchewan
    Posts
    846
    Thanks
    15
    Thanked 10 Times in 10 Posts
    Sorry for posting "Simple Questions" but once again. I'm new, I don't know everything. Also I tried searching but couldn't find anything on this. Google, these forums, other forums. I probably was searching with the wrong words. Anyway, let's see if this works.
    Dawson Irvine
    CEO - DNI Web Design
    http://www.dniwebdesign.com

  • #5
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,280
    Thanks
    4
    Thanked 83 Times in 82 Posts
    Beginning SQL
    http://www.sqlcourse.com/

    Advanced SQL
    http://www.sqlcourse2.com/

    are both good tutorials for learning SQL. You get to practice against a live database.
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •