?
Solved

Displaying specific range

Posted on 2011-02-16
3
Medium Priority
?
283 Views
Last Modified: 2012-05-11
Hello,

I have a set of 7 images.

Here is the code that I am using to show the images  
for ($i = 0; $i < $image_num; $i++):

Open in new window


It starts from the 1st image, and displays all of them in order.

How can I just show images 1 - 5, and leave out images 6 and 7? Images 6 and 7 are used for other pages.

Thanks!
0
Comment
Question by:areyouamac
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 4

Accepted Solution

by:
Allentkw earned 1600 total points
ID: 34913245
Assuming that images 1 - 5 in your array of 7 images, is ALWAYS the ones you want to show then you can use the following as your guidelines:

$maxImageNum = 5;

for ($i = 0; $i < $maxImageNum; $i++):
   //This will only loop 5 images starting from the array[0] image.

Open in new window

0
 
LVL 82

Assisted Solution

by:hielo
hielo earned 400 total points
ID: 34913311
for ($i = 0; $i < ($image_num-2); $i++):
0
 

Author Closing Comment

by:areyouamac
ID: 34913332
Both worked wonderfully.

I would have to give Alientkw 400 as he was able to answer first.

Thanks!
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question