www.webdeveloper.com
Results 1 to 2 of 2

Thread: querying with a query

  1. #1
    Join Date
    Mar 2011
    Posts
    8

    querying with a query

    Code:
    <?php
    
    $episode = $_REQUEST['episode'];
    $season = $_REQUEST['season'];
    
    
    
    if ($season)
    {
    
                         include_once ('boondocksconnect.php');
                         if ($season == 1)
                         {
                          if (!$episode)
                          {
                          $seasoninfo="SELECT * from bdseason1";
                          $seasoninfo2=mysql_query($seasoninfo) or die("could not select seasons from the boondocks.");
                          echo "<div id='box'><div id='title'><div class='entry'>
                          <p>Welcome to The Boondocks Season 1! Enjoy watching the boondocks online for free.</p>
                          <p><strong><span style='font-size: large;'>Season 1</span></strong></p><table><tbody>";
                          while($seasoninfo3=mysql_fetch_array($seasoninfo2))
                          {
                           $id = $seasoninfo3['id'];
                           $link = $seasoninfo3['link'];
                           $image = $seasoninfo3['image'];
                           $name = $seasoninfo3 ['name'];
                           $desc = $seasoninfo3 ['desc'];
                           echo "<tr>
                           <td><a href='$link'><img style='margin: 0px 10px 10px 10px;' src='$image' width='250' height='188' align='left' /><span style='font-size: small;'><strong>$name</strong></span></a></p><p>$desc</p></td>
                           </tr>";
                           }
                          echo "</tbody></table></div></div></div>";
                          }
    
                         }
                         if ($season == 2)
                         {
                          $seasoninfo="SELECT * from bdseason2";
                          $seasoninfo2=mysql_query($seasoninfo) or die("could not select seasons from the boondocks.");
                          echo "<div id='box'><div id='title'><div class='entry'>
                          <p>Welcome to The Boondocks Season 2! Enjoy watching the boondocks online for free.</p>
                          <p><strong><span style='font-size: large;'>Season 2</span></strong></p><table><tbody>";
                          while($seasoninfo3=mysql_fetch_array($seasoninfo2))
                          {
                           $id = $seasoninfo3['id'];
                           $link = $seasoninfo3['link'];
                           $image = $seasoninfo3['image'];
                           $name = $seasoninfo3 ['name'];
                           $desc = $seasoninfo3 ['desc'];
                           echo "<tr>
                           <td><a href='$link'><img style='margin: 0px 10px 10px 10px;' src='$image' width='250' height='188' align='left' /><span style='font-size: small;'><strong>$name</strong></span></a></p><p>$desc</p></td>
                           </tr>";
                           }
                          echo "</tbody></table></div></div></div>";
                         }
                         if ($season == 3)
                         {
                          $seasoninfo="SELECT * from bdseason3";
                          $seasoninfo2=mysql_query($seasoninfo) or die("could not select seasons from the boondocks.");
                          echo "<div id='box'><div id='title'><div class='entry'>
                          <p>Welcome to The Boondocks Season 3! Enjoy watching the boondocks online for free.</p>
                          <p><strong><span style='font-size: large;'>Season 3</span></strong></p><table><tbody>";
                          while($seasoninfo3=mysql_fetch_array($seasoninfo2))
                          {
                           $id = $seasoninfo3['id'];
                           $link = $seasoninfo3['link'];
                           $image = $seasoninfo3['image'];
                           $name = $seasoninfo3 ['name'];
                           $desc = $seasoninfo3 ['desc'];
                           echo "<tr>
                           <td><a href='$link'><img style='margin: 0px 10px 10px 10px;' src='$image' width='250' height='188' align='left' /><span style='font-size: small;'><strong>$name</strong></span></a></p><p>$desc</p></td>
                           </tr>";
                           }
                          echo "</tbody></table></div></div></div>";
                         }
    
    }
    
    
    
    if ($episode)
         {
              require('connectepisodes.php');
              $episodeinfo = "SELECT * from boondocks where id=$id";
              $episodeinfo2 = mysql_query($episodeinfo) or die ("could not select episode from boondocks.");
               while($episodeinfo3 = mysql_fetch_array($episodeinfo2))
             {
               require('boondockscomment.php');
               require('input.php');
               $table = $episodeinfo3['id'];
               $previous = $episodeinfo3['id']-1;
               $next = $episodeinfo3['id']+1;
               $name = $episodeinfo3['name'];
               $nextseason = 1;
               $prevseason = 1;
               $video = $episodeinfo3['video'];
               if ($next > 15 && $next < 30)
               {
                 $nextseason = 2;
               }
               if ($next > 30)
               {
                 $nextseason = 3;
               }
               if ($previous > 15 && $previous < 30)
               {
                 $prevseason = 2;
               }
               if ($previous > 30)
               {
                 $prevseason = 3;
               }
               echo "<div id='box'><div id='title'><div class='entry'>";
               if ($next < 45)
               {
                echo "<a href='boondocks.php?season=$nextseason&episode=$next'>Next Episode</a>";
               }
               echo "<p><strong><span style='font-size: large;'>$name</span></strong></p>
               <table><tr><td>$video";
               if ($previous > 1)
               {
                 echo "<a href='boondocks.php?season=$prevseason&episode=$previous'>Previous Episode</a>";
               }
               echo "<script src='http://connect.facebook.net/en_US/all.js#xfbml=1'></script><fb:like show_faces='true' width='450'></fb:like>
                     <a expr:share_url='data:post.url' href='http://www.facebook.com/sharer.php' name='fb_share' type='button_count'>Share on Facebook</a><script src='http://static.ak.fbcdn.net/connect.php/js/FB.Share' type='text/javascript'></script>
                     </td></tr>";
    
    
               }
    
            }
    
    
    
    if (!$season)
    {
    require('boondocksfeat.php');
    }
    
    
    ?>


    the queries are working but I need some help with this :
    when i click on the season, the season query works, when i click on the episode I have 2 queries how can I stop the first one and let only the second one run please help.

  2. #2
    Join Date
    Apr 2011
    Location
    I live in the pinaple under the sea
    Posts
    107
    Just validate if the query string is available

    PHP Code:
    if(isset($_REQUEST['episode']))
    {
         
    // query for episode
    }else if(isset($_REQUEST['season']))
    {
         
    // query for season


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles