how to skip iteration of while loop in associative array means we want to execute first ,second, fourth,fifth like this?How to determine the first and last iteration in a foreach loop?How to loop through an associative array and get the key?How to iterate over associative arrays in BashZend Framework layout or view lagHow to Initialize an Associative Array in a While Loop?Function names in WordpressIterate through an associative array in while loopHow to iterate an associative arrayUncaught Error: Cannot use object of type WP_Post as arrayGet_post not displaying data

What's the correct term for a waitress in the Middle Ages?

Completing the square to find if quadratic form is positive definite.

Incremental Ranges!

Do manufacturers try make their components as close to ideal ones as possible?

Traffic law UK, pedestrians

Can a magnetic field of an object be stronger than its gravity?

What do we gain with higher order logics?

What are the words for people who cause trouble believing they know better?

Function to extract float from different price patterns

Working in the USA for living expenses only; allowed on VWP?

Pronoun introduced before its antecedent

Finding x,y coordinates where y is largest

Identification quotas - TIKZ LaTeX

Avoiding cliches when writing gods

Pay as you go Or Oyster card

Is there any word or phrase for negative bearing?

Credit card offering 0.5 miles for every cent rounded up. Too good to be true?

How to skip replacing first occurrence of a character in each line?

Is it possible to trip with natural weapon?

Payment instructions from HomeAway look fishy to me

My coworkers think I had a long honeymoon. Actually I was diagnosed with cancer. How do I talk about it?

How do I write "Show, Don't Tell" as an Asperger?

How to decline physical affection from a child whose parents are pressuring them?

In this example, which path would a monster affected by the Dissonant Whispers spell take?



how to skip iteration of while loop in associative array means we want to execute first ,second, fourth,fifth like this?


How to determine the first and last iteration in a foreach loop?How to loop through an associative array and get the key?How to iterate over associative arrays in BashZend Framework layout or view lagHow to Initialize an Associative Array in a While Loop?Function names in WordpressIterate through an associative array in while loopHow to iterate an associative arrayUncaught Error: Cannot use object of type WP_Post as arrayGet_post not displaying data






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















i am creating a CMS system. if post is not published then it will not render in html otherwise show in html. So if I fetch a associative array from database "cms" then it has some published and unpublished post. so how can i skip the unpublished posts and show only published posts in html.



i have tried if condition





 <!-- First Blog Post -->
<h2 style = "color:green;">
<?php echo $post_title ;?></a>
</h2>
<p class="lead">
by <?php echo $post_author ;?></a>
</p>
<p><span class="glyphicon glyphicon-time"></span><?php $post_date ?></p>
<hr>
<img class="img-responsive" src="images/<?php echo $post_image ;?>" alt="">
<hr>
<p><?php echo $post_content ?></p>
<a class="btn btn-primary" href="#">Read More <span class="glyphicon glyphicon-chevron-right"></span></a>

<hr>


**<?php } ?> **
**<?php } **// <!--loop ends here so that we can fetch 'n' no. of posts and displaying each post like below HTML -->

?>
</div>


if post == published then only show it in html otherwise don't show it.










share|improve this question




























    0















    i am creating a CMS system. if post is not published then it will not render in html otherwise show in html. So if I fetch a associative array from database "cms" then it has some published and unpublished post. so how can i skip the unpublished posts and show only published posts in html.



    i have tried if condition





     <!-- First Blog Post -->
    <h2 style = "color:green;">
    <?php echo $post_title ;?></a>
    </h2>
    <p class="lead">
    by <?php echo $post_author ;?></a>
    </p>
    <p><span class="glyphicon glyphicon-time"></span><?php $post_date ?></p>
    <hr>
    <img class="img-responsive" src="images/<?php echo $post_image ;?>" alt="">
    <hr>
    <p><?php echo $post_content ?></p>
    <a class="btn btn-primary" href="#">Read More <span class="glyphicon glyphicon-chevron-right"></span></a>

    <hr>


    **<?php } ?> **
    **<?php } **// <!--loop ends here so that we can fetch 'n' no. of posts and displaying each post like below HTML -->

    ?>
    </div>


    if post == published then only show it in html otherwise don't show it.










    share|improve this question
























      0












      0








      0








      i am creating a CMS system. if post is not published then it will not render in html otherwise show in html. So if I fetch a associative array from database "cms" then it has some published and unpublished post. so how can i skip the unpublished posts and show only published posts in html.



      i have tried if condition





       <!-- First Blog Post -->
      <h2 style = "color:green;">
      <?php echo $post_title ;?></a>
      </h2>
      <p class="lead">
      by <?php echo $post_author ;?></a>
      </p>
      <p><span class="glyphicon glyphicon-time"></span><?php $post_date ?></p>
      <hr>
      <img class="img-responsive" src="images/<?php echo $post_image ;?>" alt="">
      <hr>
      <p><?php echo $post_content ?></p>
      <a class="btn btn-primary" href="#">Read More <span class="glyphicon glyphicon-chevron-right"></span></a>

      <hr>


      **<?php } ?> **
      **<?php } **// <!--loop ends here so that we can fetch 'n' no. of posts and displaying each post like below HTML -->

      ?>
      </div>


      if post == published then only show it in html otherwise don't show it.










      share|improve this question














      i am creating a CMS system. if post is not published then it will not render in html otherwise show in html. So if I fetch a associative array from database "cms" then it has some published and unpublished post. so how can i skip the unpublished posts and show only published posts in html.



      i have tried if condition





       <!-- First Blog Post -->
      <h2 style = "color:green;">
      <?php echo $post_title ;?></a>
      </h2>
      <p class="lead">
      by <?php echo $post_author ;?></a>
      </p>
      <p><span class="glyphicon glyphicon-time"></span><?php $post_date ?></p>
      <hr>
      <img class="img-responsive" src="images/<?php echo $post_image ;?>" alt="">
      <hr>
      <p><?php echo $post_content ?></p>
      <a class="btn btn-primary" href="#">Read More <span class="glyphicon glyphicon-chevron-right"></span></a>

      <hr>


      **<?php } ?> **
      **<?php } **// <!--loop ends here so that we can fetch 'n' no. of posts and displaying each post like below HTML -->

      ?>
      </div>


      if post == published then only show it in html otherwise don't show it.







      php associative-array






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 24 at 14:20









      Varun VermaVarun Verma

      31




      31






















          1 Answer
          1






          active

          oldest

          votes


















          1














          Check if post is not published at the start of the loop. then use the continue to skip through the rest of the loop.



          while(items)
          if(!$post->published) continue;
          // this part only runs if post is published






          share|improve this answer























          • thankyou sir . It works

            – Varun Verma
            Mar 24 at 15:15











          • @VarunVerma you're welcome

            – Festus Yuma
            Mar 24 at 15:50











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55324748%2fhow-to-skip-iteration-of-while-loop-in-associative-array-means-we-want-to-execut%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          Check if post is not published at the start of the loop. then use the continue to skip through the rest of the loop.



          while(items)
          if(!$post->published) continue;
          // this part only runs if post is published






          share|improve this answer























          • thankyou sir . It works

            – Varun Verma
            Mar 24 at 15:15











          • @VarunVerma you're welcome

            – Festus Yuma
            Mar 24 at 15:50















          1














          Check if post is not published at the start of the loop. then use the continue to skip through the rest of the loop.



          while(items)
          if(!$post->published) continue;
          // this part only runs if post is published






          share|improve this answer























          • thankyou sir . It works

            – Varun Verma
            Mar 24 at 15:15











          • @VarunVerma you're welcome

            – Festus Yuma
            Mar 24 at 15:50













          1












          1








          1







          Check if post is not published at the start of the loop. then use the continue to skip through the rest of the loop.



          while(items)
          if(!$post->published) continue;
          // this part only runs if post is published






          share|improve this answer













          Check if post is not published at the start of the loop. then use the continue to skip through the rest of the loop.



          while(items)
          if(!$post->published) continue;
          // this part only runs if post is published







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 24 at 14:34









          Festus YumaFestus Yuma

          1806




          1806












          • thankyou sir . It works

            – Varun Verma
            Mar 24 at 15:15











          • @VarunVerma you're welcome

            – Festus Yuma
            Mar 24 at 15:50

















          • thankyou sir . It works

            – Varun Verma
            Mar 24 at 15:15











          • @VarunVerma you're welcome

            – Festus Yuma
            Mar 24 at 15:50
















          thankyou sir . It works

          – Varun Verma
          Mar 24 at 15:15





          thankyou sir . It works

          – Varun Verma
          Mar 24 at 15:15













          @VarunVerma you're welcome

          – Festus Yuma
          Mar 24 at 15:50





          @VarunVerma you're welcome

          – Festus Yuma
          Mar 24 at 15:50



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55324748%2fhow-to-skip-iteration-of-while-loop-in-associative-array-means-we-want-to-execut%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

          Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript