February 8th, 2014, 05:14 AM
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:
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:
Each page is dedicated to their own table of games. The table structure is as follows:
<td class="c2">007: Everything or Nothing</td>
<td class="c2">007: From Russia with Love</td>
<td class="c2">007: Nightfire</td>
<td class="c2">101-in-1 Party Megamix</td>
<td class="c2">101-in-1 Sports Party Megamix</td>
- 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:
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:
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:
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.
<td class="td1" colspan="2">PERFECT</td>
<td class="c2">"Aha! I Got It!" Escape Game</td>
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.
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.
February 8th, 2014, 08:33 AM
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.