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;
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
add a comment |
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
add a comment |
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
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
php associative-array
asked Mar 24 at 14:20
Varun VermaVarun Verma
31
31
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
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
thankyou sir . It works
– Varun Verma
Mar 24 at 15:15
@VarunVerma you're welcome
– Festus Yuma
Mar 24 at 15:50
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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
thankyou sir . It works
– Varun Verma
Mar 24 at 15:15
@VarunVerma you're welcome
– Festus Yuma
Mar 24 at 15:50
add a comment |
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
thankyou sir . It works
– Varun Verma
Mar 24 at 15:15
@VarunVerma you're welcome
– Festus Yuma
Mar 24 at 15:50
add a comment |
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
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
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
add a comment |
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
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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