Jump to content

Recommended Posts

I'm new to MySQL / PHP and am trying to set up a system where a site visitor can post a recommendation with the following:

  - title
  - description
  - URL link
  - category

I set up the tables using normalization 1, 2, and 3 techniques. This resulted in the title and description being in one table while the links and the categories were in two different tables that used foreign keys to 'connect' to the main table.

My issue is this. I am using Dreamweaver to set up the dynamic side of the site. I expected to be able to create recordsets and  capture the info from the tables and use the 'repeat region' feature to get it to cycle through the tables and get all the info. Unfortunately, the information is nested (I need it to go 'title', 'description', 'link' in that order. DW wouldn't allow that.

What technique do I use to do this? I am wondering about the JOIN feature in MySQL. Is it possible to use an INNER JOIN and then work with that table?

I'm going to post a chunk of code that represents the area I am talking about. I know it doesn't work right and I understand why. I just don't know what approach will get it to work. Thanks for any and all help.

Ryan.OD
--
<div id="content_main">
    <div class="art">
    <?php do { ?>
        <h3>
          <?php do { ?>
            <a href="<?php echo $row_Recordset2['url_link']; ?>">
              <?php } while ($row_Recordset2 = mysql_fetch_assoc($Recordset2)); ?>
              <?php echo $row_Recordset3['title_post']; ?>
</a>
</h3>
    <p>
<?php echo $row_Recordset3['intro_post']; ?>
            <?php } while ($row_Recordset3 = mysql_fetch_assoc($Recordset3)); ?>
    </p>

        <?php do { ?>
        <h5>
<?php echo $row_Recordset4['cat_category']; ?>
        <?php } while ($row_Recordset4 = mysql_fetch_assoc($Recordset4)); ?>
</h5>
</div>
  </div>
Link to comment
https://forums.phpfreaks.com/topic/21923-help-getting-data-from-normalized-tables/
Share on other sites

I thought that was the entire idea behind database normalization. Whenever there is a one-to-many or many-to-many relationship, the designer should break the table up into smaller tables (each with their own primary key) and link them with foreign keys.

Initially, I used one table (and everything worked fine). Then, after doing some research about db design, I went back and redesigned my dbs so they satisfied db normalization up to normal level 3.

Perhaps I am mistaken, but I was under the impression I was understanding db design pretty well.
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.