Solved

Displaying specific range

Posted on 2011-02-16
3
276 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
3 Comments
 
LVL 4

Accepted Solution

by:
Allentkw earned 400 total points
Comment Utility
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 100 total points
Comment Utility
for ($i = 0; $i < ($image_num-2); $i++):
0
 

Author Closing Comment

by:areyouamac
Comment Utility
Both worked wonderfully.

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

Thanks!
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…

763 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now