#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2014
    Posts
    4
    Rep Power
    0

    Removing table from HTML and populating it with table and data from MySQL instead?


    This is a copy/paste from the MySQL Help forum as I was told that this would be the proper place to ask it.

    The original post with responses can be found here:

    http://forums.devshed.com/mysql-help-4/removing-table-from-html-and-populating-it-with-table-and-957924.html

    I would first like say (and admit) that I am very new to databases. I've never needed to deal with one before so PHP and MySQL are alien to me.

    I currently have a site spanning 5 pages totaling around 3,000 of the following:

    Code:
    <tr class="tr2">
      <td class="c1">Gamecube</td>
      <td class="c2">007: Everything or Nothing</td>
     </tr>
     <tr class="tr2">
      <td class="c1">Gamecube</td>
      <td class="c2">007: From Russia with Love</td>
     </tr>
     <tr class="tr2">
      <td class="c1">Gamecube</td>
      <td class="c2">007: Nightfire</td>
     </tr>
     <tr class="tr2">
      <td class="c1">Wii</td>
      <td class="c2">101-in-1 Party Megamix</td>
     </tr>
     <tr class="tr2">
      <td class="c1">Wii</td>
      <td class="c2">101-in-1 Sports Party Megamix</td>
     </tr>
    Each page is dedicated to their own table of games. The table structure is as follows:

    • Table title (level of compatibility)/Row 1
    • Column 1 title (System)/Row 2
    • Column 2 title (Title)/Row 2
    • Row 3 and onward start the list (system names and game titles)


    It looks like this:

    http://i.imgur.com/DoCuHrQ.png

    You can see what the 5 pages and tables are labeled by looking at the nav menu.

    Again, each of the 5 (compatibility level) pages have their own colored table with their own system name/game titles.
    I have created an excel sheet containing every system name/game title with column 1 being the system titles and column 2 being the game titles.

    It looks like this:

    http://i.imgur.com/g6lN7c9.png

    Notice rows 1 and 2, table title and column titles respectively (refer to the table structure above.) Since taking that screenshot, I have separated those 5 tables into their own excel sheet based on the level of compatibility.

    What I need is to delete these thousands of table rows in my HTML code and have it refer to the database in order to populate itself, without any changes to the design you see in the first image.

    To help, here is what the start of a table looks like:

    Code:
    <table id="perfect">
     <col style='width:125'>
     <col style='width:623'>
    
    <!--PERFECT-->
    
     <tr class="tr1">
      <td class="td1" colspan="2">PERFECT</td>
     </tr>
     <tr class="tr1">
      <td class="c1">Wiiware</td>
      <td class="c2">"Aha! I Got It!" Escape Game</td>
    Line 8 is table title/row 1, line 11 is system name/row 2, column 1, and line 12 is game title/row 2, column 2.

    For better assistance, I've uploaded an entire page of code below to give a better idea of what each page looks like currently, and what I want it to look like after I've cleaned up my HTML and use MySQL instead.

    http://pastebin.com/wfKxamy4

    Imagine lines 47 to 881 removed and instead the information is gathered from the database. The table sizes vary. The only real differences between the pages are the color of the table and the games.

    Thank you all for your help.

    ETA: For what it's worth, my site is hosted on Zymic. I've set up a DB on Zymic using their integrated SQL Buddy system with a table, so I think I'm getting close.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2003
    Posts
    3,623
    Rep Power
    595
    While your project seems relatively basic, you still need a good understanding of PHP, MySQL and how to use them together. You might start with Jacques1's article.
    There are 10 kinds of people in the world. Those that understand binary and those that don't.

IMN logo majestic logo threadwatch logo seochat tools logo