Closed Thread
Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 38

Thread: Displaying records from a mySQL DB

  1. #21
    dp26 is offline Newbie
    Join Date
    Mar 2010
    Posts
    13
    Rep Power
    0

    Re: Displaying records from a mySQL DB

    Is there a tutorial that you can suggest on this? I should probably understand this better before I waste any more of my time.

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #22
    Arctic Fire is offline Learning Programmer
    Join Date
    Aug 2009
    Posts
    48
    Rep Power
    0

    Re: Displaying records from a mySQL DB

    I don't know of any tutorials off the top of my head, but this might help you. This would be your teaminfo.php file. Call it like:
    http://example.com/teaminfo.php?id=7

    Code:
    <?php

    mysql_connect
    ("localhost","username","password");
    mysql_select_db("database_name");

    $id = (int)$_GET['id'];
    $query mysql_query("SELECT * FROM teams WHERE id = '$id'");

    if(
    mysql_num_rows($query) == 0)
    {
        echo 
    "Team ID incorrect";
    } else {
        
    $info mysql_fetch_assoc($query);
        
    print_r($info);
    }

    ?>

  4. #23
    dp26 is offline Newbie
    Join Date
    Mar 2010
    Posts
    13
    Rep Power
    0

    Re: Displaying records from a mySQL DB

    That worked. Now I need to figure out how to format that

    The sad thing (on my part) is I have a very in depth and complicated data model but don't know how to apply it. Meaning right now I have one massive form that handles the entire team and roster information when the team should have a unique ID and so should each player. Since I am such a newb, I have to wade into this slowly and figure it out as I go.

  5. #24
    dp26 is offline Newbie
    Join Date
    Mar 2010
    Posts
    13
    Rep Power
    0

    Re: Displaying records from a mySQL DB

    echo "<td>" . $row['TeamName'] . "</td>";

    How do I link TeamName to the appropriate roster thru teaminfo.php?

  6. #25
    albernrambo is offline Newbie
    Join Date
    Mar 2010
    Posts
    1
    Rep Power
    0

    Re: Displaying records from a mySQL DB

    it is better to display the products in category and subcategory and images .it will make your website better and give it a attractive looks and it is easy to maitain

  7. #26
    dp26 is offline Newbie
    Join Date
    Mar 2010
    Posts
    13
    Rep Power
    0

    Re: Displaying records from a mySQL DB

    I don't know how difficult this is but I thought I might post it and see if anyone could help. Here is what I am looking for:

    Teams Page = https://www.usssa.com/sports/Rank2.a...3&RankSystem=2

    And I want to have the team link to the roster page which would be like...

    https://www.usssa.com/sports/viewtea...teamid=1286618

    I've accomplished parts of this but in most cases when I start messing around with the code I wreck something because I am such a newb. If I had the code to pull this off I could greatly expand this to do greater things, this is just the first step to make my customers lives a ton easier.

    The teams and rosters are in the same table (i know, poor database design, i have a better one but don't know how to deal with forms/nested tables yet), so basically the teams page is a smaller set of rosters. Rosters page would include everything (only I would keep sensitive information out).

    Can anyone help?

  8. #27
    Arctic Fire is offline Learning Programmer
    Join Date
    Aug 2009
    Posts
    48
    Rep Power
    0

    Re: Displaying records from a mySQL DB

    Quote Originally Posted by dp26 View Post
    echo "<td>" . $row['TeamName'] . "</td>";

    How do I link TeamName to the appropriate roster thru teaminfo.php?
    I'm not sure what you're asking. The elements of the $row array, or in the case of the code I posted above, the $info array, have the key name of the column in the database they come from.

  9. #28
    dp26 is offline Newbie
    Join Date
    Mar 2010
    Posts
    13
    Rep Power
    0

    Re: Displaying records from a mySQL DB

    So I have a list of teams. I want the team name to link to the record that has more team information.

  10. #29
    Arctic Fire is offline Learning Programmer
    Join Date
    Aug 2009
    Posts
    48
    Rep Power
    0

    Re: Displaying records from a mySQL DB

    What is the scheme of your table in the database?

  11. #30
    dp26 is offline Newbie
    Join Date
    Mar 2010
    Posts
    13
    Rep Power
    0

    Re: Displaying records from a mySQL DB

    id int(10) UNSIGNED No None auto_increment Browse distinct values Change Drop Primary Unique Index Fulltext
    TeamName text utf8_general_ci No None Browse distinct values Change Drop Primary Unique Index Fulltext
    Community text utf8_general_ci No None Browse distinct values Change Drop Primary Unique Index Fulltext
    State text utf8_general_ci No None Browse distinct values Change Drop Primary Unique Index Fulltext
    Class text utf8_general_ci No None Browse distinct values Change Drop Primary Unique Index Fulltext
    Division text utf8_general_ci No None Browse distinct values Change Drop Primary Unique Index Fulltext
    Points text utf8_unicode_ci No None Browse distinct values Change Drop Primary Unique Index Fulltext
    TeamManager text utf8_general_ci No None Browse distinct values Change Drop Primary Unique Index Fulltext
    ManagerAddress text utf8_general_ci No None Browse distinct values Change Drop Primary Unique Index Fulltext
    ManagerCity text utf8_general_ci No None Browse distinct values Change Drop Primary Unique Index Fulltext
    ManagerState text utf8_general_ci No None Browse distinct values Change Drop Primary Unique Index Fulltext
    ManagerZip text utf8_general_ci No None Browse distinct values Change Drop Primary Unique Index Fulltext
    Phone text utf8_general_ci No None Browse distinct values Change Drop Primary Unique Index Fulltext
    Email text utf8_general_ci No None Browse distinct values Change Drop Primary Unique Index Fulltext

Closed Thread
Page 3 of 4 FirstFirst 1234 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. mysql records
    By tontonskie in forum Database & Database Programming
    Replies: 4
    Last Post: 12-13-2010, 04:18 PM
  2. Displaying MySQL data in HTML with PHP
    By dunnkers in forum PHP Development
    Replies: 4
    Last Post: 07-16-2010, 08:53 AM
  3. How can I delete mySQL records from an html or jsp page?
    By bigz008 in forum Database & Database Programming
    Replies: 2
    Last Post: 03-05-2010, 09:37 AM
  4. displaying mysql data into jtextfield.Pls help
    By iz.ziffa in forum Java Help
    Replies: 1
    Last Post: 05-31-2007, 08:58 AM

Tags for this Thread

Bookmarks

Posting Permissions

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