ryan.od Posted September 25, 2006 Share Posted September 25, 2006 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 - categoryI 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> Quote Link to comment https://forums.phpfreaks.com/topic/21923-help-getting-data-from-normalized-tables/ Share on other sites More sharing options...
sasa Posted September 25, 2006 Share Posted September 25, 2006 can you post structure of your db Quote Link to comment https://forums.phpfreaks.com/topic/21923-help-getting-data-from-normalized-tables/#findComment-98478 Share on other sites More sharing options...
ryan.od Posted September 26, 2006 Author Share Posted September 26, 2006 Yes, the db structure is attached to this post. Thanks.recordset2 refers to the reviews_link tablerecordset3 refers to the reviews_post tablerecordset4 refers to the reviews_category table[attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/21923-help-getting-data-from-normalized-tables/#findComment-98636 Share on other sites More sharing options...
redarrow Posted September 26, 2006 Share Posted September 26, 2006 Why not change the database to 1 table then insert the information. Quote Link to comment https://forums.phpfreaks.com/topic/21923-help-getting-data-from-normalized-tables/#findComment-98640 Share on other sites More sharing options...
ryan.od Posted September 26, 2006 Author Share Posted September 26, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/21923-help-getting-data-from-normalized-tables/#findComment-98683 Share on other sites More sharing options...
HuggieBear Posted September 26, 2006 Share Posted September 26, 2006 Ryan, you're spot on!I can't look at this now as I'm really busy, but I'll check this evening when I get in from work and I'll see what I can do.RegardsHuggie Quote Link to comment https://forums.phpfreaks.com/topic/21923-help-getting-data-from-normalized-tables/#findComment-98779 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.