Enter titles in db when displayed in table

I have a db that I am reading 24 values from. I right now have a table that everything is being displayed through. All of that works great. But I have a need that I cannot even start to figure out.

I have three sections in the table. Right now it is just a straight table displaying everything all in one line. But, I have the table sorted by category, and I have three of those. I have a header at the top of the table that shows what the columns represent. This will be the same for all categories. So at the very top of the table, I have a explanation of that the first category represents. All of this is working, just don’t ask me about how it looks because it is ugly right now.

But, here is my problem. At the beginning of the second and third categories, I would like to place an explanation of what the category means. So something like this:

 category one explanation
col1 col2 col3 col4
category two explanation
col1 col2 col3 col4
category three explanation
col1 col2 col3 col4

Since I am reading all of this from a db that is where my problem comes in. How do I add the explanation in at the right time, or at all actually… I am not even sure where to begin with this. The order of the categories will never change, But I am going to be using the db for other functions so I can’t see hard coding everything in a static HTML page.

Any ideas will be greatly appreciated.

Can you tel;l us the structure of your database?

My first impression is if you’re needing to have explanation for categories that they are either not descriptive enough or they shouldn’t be categories in the first place. Like someone already stated need to know the structure of the database table and maybe even a little code to see what is happening.

A good way to do this is to output the structure in MySQL, for example:

  `id` int(11) NOT NULL,
  `user_id` int(11) DEFAULT NULL,
  `author` varchar(160) DEFAULT NULL,
  `page` varchar(255) DEFAULT 'index',
  `thumb_path` varchar(255) DEFAULT NULL,
  `image_path` varchar(255) DEFAULT NULL,
  `Model` varchar(255) DEFAULT NULL,
  `ExposureTime` varchar(255) DEFAULT NULL,
  `Aperture` varchar(255) DEFAULT NULL,
  `ISO` varchar(255) DEFAULT NULL,
  `FocalLength` varchar(255) DEFAULT NULL,
  `heading` varchar(60) DEFAULT NULL,
  `content` text CHARACTER SET utf8 COLLATE utf8_unicode_ci,
  `date_updated` datetime DEFAULT NULL,
  `date_added` datetime DEFAULT NULL

-- Indexes for dumped tables

-- Indexes for table `cms`

-- AUTO_INCREMENT for dumped tables

-- AUTO_INCREMENT for table `cms`

This is a snippet of the table. This shows the different categories Freya, Hagal, and Tyr. I need a explanation, maybe that isn’t quite the right word, but that is all I can come up with at the moment.

Anyway, here is part of the db. There are 24 entries in total, 8 per category.

|Freya’s Aettir|Fehu|F|Green|Cattle, Mobile force,Energy, Fertility,Creation/destruction|Fehu is a rune of power and control. It represents new beginnings and movable wealth such as money and credit. It is a rune that gives us the power we need to obtain wealth as well as the power we need to hold on to it. It strengthens psychic powers,Channel for power transference or projection, the sending rune, Drawing the projected power of the sun, moon, and stars into the personal sphere,Promotion of personal and social evolution,Increase in personal monetary wealth.|
|Hagal's Aettir|Jera|J the same|Brown|Harvest or Year or Season|Jera is a rune that represents the cycle of life. With this rune we see that we must go with the flow of nature to obtain the goals we want.|
|Tyr's Aettir|Teiwaz|T|Green|Creator|Teiwaz can promise us success in our actions but this time without personal sacrifice. It also means success in legal matters but only if we were in the right to begin with.

And here is the entire script I am using for the page…

<?php // Load variables require_once 'dbconn.php'; print <<< END p { text-align: left; text-size = "18px"; color = #000; } table#table1 { width:80%; margin-left:10%; margin-right:10%; border-style: solid; border-width: 1px; border-color: black; } tr.border_bottom td { border-bottom: 1px solid black; } The First Aett represents the Life Cycle. END; //Make a connection to the database $pdo = new PDO("mysql:host=$SVR;dbname=$NAME;charset=$CHARSET", "$USER", "$PASS"); $stmt = $pdo->prepare('SELECT * FROM runes ORDER BY aett'); $stmt->execute(); while ($user = $stmt->fetch()) { print <<< TABLE TABLE; } print <<< BOTTOM
Listing of Runes and Their Meanings

An Aettir, or Aett, is a division within the runes. Each Aett is associated with a different meaning. The Aettir not only imply an initiatory structure, each Aett being one degree in a three-degree system, but they seem to reflect the age-old division of tribal society: the nurturer, the warrior, and the priest or king.

The first Aett is Freya's, the Aett of the nurturer: the mother, the farmer, and the merchant.

These divisions are reflected in the Aetir of the Runes in different ways. If you look carefully, you may notice some overlap in the duties of the Runes. Each Aett has its complement of functions and its own character.

The Runes you choose to use, whether individually or combined are affected by the Aett in which they belong. There is more to a choice between Kenaz, Sowilo, and Othala than personal preference. There is a greater difference between Isa and Tiwaz, both being representative of a spear, than Isa and Hagalaz, both being representative of ice or winter.

The nature of this balance differs depending on which Aett is involved. This difference reflects the group of the society to which the Rune belongs.

So Fehu is wealth within Freya's Aett of the nurturer, while Ingwaz is wealth (or property) within the terms of the priest/king.

Aettir Name Sound Color Keywords Description
$user[aett] $user[name] $user[sound] $user[color] $user[s_key] $user[l_key]
BOTTOM; The dbconn file is just the db info for connecting... Thanks for reading! Jim
Sponsor our Newsletter | Privacy Policy | Terms of Service