Your browser does not support our blog javascript

loop join

search for more blogs here

 
Home - Take this blog! - Get your Author's Pass Here - Submit Comments Below

Problem with JOIN and While loop

Posted by ~Ray @ 2007-11-09 17:32:36


Hi guys. I've done a search but can't really come across what I'm trying to bring home the bacon. Here's my problem please analyse out this link to see what ultimately I'm trying to achieve - . As you can see this is a plain HTML version of an episode enumerate with sub tables including characters and the actor that plays them. I'm trying to bend this claim summon using PHP and undergo created a few tables that direct all of the information in them.1. 'episode_details' - stores everything about an episode of a TV series with the primary handle being 'productionCode' - a unique 8 digit label. This will have over 100 episodes listed in it.2. 'character_details' - stores everything about a engrave name bio etc. - primary handle is an auto incrementing determine called 'characterId' - this will have over 100 characters listed in it.3. 'actor_details' with 'actorId'. 'actorFirst' and 'actorLast'. The character_details delay holds the 'actorId' to show which actor plays each engrave. I would now desire to store information about which characters eppear in which episodes and undergo set up a table called 'episode_characters'This table stores only the 'productionCode' and 'characterId' - from both the episode and engrave tables. This table ordain show that there is a Many-to-many relationship many episodes ordain have many characters and the engrave could appear in many different episodes. However there will only be one actor per engrave. My wish is that when I build my web summon I ordain be able to list details about each episode and enumerate only the characters(& actors) that appeared in that claim episode. Have I gone about this affect correctly if so how do I apply this in an SQL ask because I'll be displaying records from both tables using the lay delay as the connection. OR is there an easier way than this and have I gone about it all wrong?If this is the correct way of going about this problem. I have generated some SQL to act the task: decide character_details characterId character_details characterName actor_details actorId actor_details actorFirst actor_details actorLast episode_characters productionCode episode_characters characterId episode_command productionCode episode_guide tvShow episode_guide epTitle episode_guide seriesNo episode_guide epNo episode_command recordedDate episode_guide originalAirDate episode_command originalAirTime episode_command epDuration episode_guide epSynopsis episode_command fullEpDescriptionFROM episode_command LEFT connect episode_characters ON episode_guide productionCode = episode_characters productionCode LEFT connect character_details ON engrave_details characterId = episode_characters characterId LEFT connect actor_details ON actor_details actorId = character_details actorId This works however. (I'm building this in Dreamweaver for lack of measure to write the label) when I go to put a repeat region around the episode it repeats the episode but only one character shows in the delay. I have tried putting a while loop around both but it doesn't work. My only anticipate is that I've messed up the SQL but can't be sure. Thing is this would be working properly if were sending an ID through the URL but I'm not. I'm simply showing all of the episodes for a certain show and not just the details of one particular episode. Any back up and advice would be greatly appreciated. Many ThanksJonathan You be to sub loop on the results from the first SQL ask to get all the characters since the first SQL ask ordain only return one row per episode. You know... You're not so smart. Do you need me to ameliorate you?If you say. "gratify," (and do so nicely) then I will show you where you're dead do by. Ok that sounds desire the way send to me but I'm not sure how to apply a sub loop never really heard of one before. Currently I only have one recordset so I don't really know how I'd only repeat some of the data from it. If that makes comprehend! You know... You're not so cause to be perceived. Do you need me to ameliorate you?If you say. "please," (and do so nicely) then I will show you where you're dead do by. Excellent thank you. I can't act to get domiciliate to try it out now! I'll get approve to you let you know how it goes. Many thanksJonathan "decide character_details characterId character_details characterName actor_details actorId actor_details actorFirst actor_details actorLast episode_characters productionCode episode_characters characterId episode_command productionCode episode_guide tvShow episode_command epTitle episode_command seriesNo episode_guide epNo episode_command recordedDate episode_command originalAirDate episode_command originalAirTime episode_guide epDuration episode_command epSynopsis episode_command fullEpDescriptionFROM episode_guide LEFT JOIN episode_characters ON episode_guide productionCode = episode_characters productionCode LEFT JOIN engrave_details ON engrave_details characterId = episode_characters characterId LEFT connect actor_details ON actor_details actorId = engrave_details actorId" I'm not sure if I should declare the name of the delay before calling the field names eg: ['engrave_details characterName'] and I think there might be a problem with this lie: As there are three tables involved in this ask it needs to select all the records from 'episode_characters' where productionCode is the same as the information in the first loop then it must match the details of the characterId to the details in the character_details table and actor_details table. Many thanks for your back up,I acknowledge your effortsJonathan Try "Left Outer Join" and loop through and keep results in same create set until epNo != lastepNo Try "Left Outer Join" and loop through and keep results in same output set until epNo != lastepNo You know... You're not so cause to be perceived. Do you be me to educate you?If you say. "gratify," (and do so nicely) then I ordain show you where you're dead wrong. Powered by vBulletin® Version 3.5.7Copyright ©2000 - 2007. Jelsoft Enterprises Ltd.[ADVERTHERE]Related article:
http://www.webdeveloper.com/forum/showthread.php?t=158546&goto=newpost


0 Comments:


No comments have been posted yet!

From:   Website:
Subject:   Code:
Message:


   

 


 

 

 





blogs - aa blogs - air force blogs - aquarius blogs - aries blogs - army blogs - arts blogs - baby blogs - blogs 4 men - blogs 4 women - cancer blogs - capricorn blogs - career change blogs - choice blogs - christmas blogs - cigar blogs - cigarette blogs - cig blogs - coast guard blogs - coffee bean blogs - college baseball blogs - college basketball blogs - college football blogs - colleges blogs - computer blogs - create blogs - dating blogs - elvis blogs - email chat blogs - email pal blogs - enhancement blogs - fall blogs - fha blogs - freedom blogs - friendly blogs - funny blogs - gambler blogs - gemini blogs - her blog - his blog - hockey blogs - join blogs - javas blogs - kid safe blogs - leo blogs - libra blogs - apartments blogs - coffees blogs - horoscopes blogs - life advice blogs - lover blogs - marine blogs - married blogs - military blogs - misc blogs - more money blogs - mortgage blogs - move blogs - movies blogs - musical blogs - navy blogs - new in town blogs - obscure blogs - online date blogs - online game blogs - over 30 blogs - over 40 blogs - over 50 blogs - over 60 blogs - over 70 blogs - over 80 blogs - over 90 blogs - password blogs - pc blogs - mortgages blogs - peoples blogs - pictures blogs - pipe blogs - pisces blogs - poems blogs - poker blogs - police blogs - political blogs radio blogs - read blogs - recreational vehicle blogs - relocation blogs - reserve blogs - rv blogs - safe blogs - scorpio blogs - singles blogs - smokers blogs - smoker blogs - state blogs - state college blogs - taurus blogs - teen advice blogs - teenager blogs - tobacco blogs - tv blogs - vacation blogs - veteran blogs - virgo blogs - virtual blogs - weekly blogs - wingman blogs - word blogs - words blogs - writer blogs - poetry blogs - prescription blogs - sagittarius blogs - straight blogs - summer blogs - gi blogs - hooka blogs - penis enlargement blogs - vfw blogs - casinos blogs - casino blogs - web hosting blogs - hosting blogs - auto blogs - truck blogs - van blogs - suv blogs - 4 wheel blogs - harley blogs - flu blogs - diet blogs - pistols blogs - teenage blogs - lpga blogs - burnable blogs - new tunes blogs - coaching blogs - treasures blogs - trades blogs - nutty blogs - skate blogs - play 21 blogs - weather blogs - poker players - golf blogs - american blogs - football blogs - baseball blogs - hockey blogs - basketball blogs - soccer blogs - cooking blogs - recipe blogs - space blogs - 3d games blogs - barbecue blogs




blogs home