Solved

Displaying specific range

Posted on 2011-02-16
3
280 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 400 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 100 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MySQL Persistent Connections 10 35
Making Table Thru ASP Response.write 5 19
MySQL-Design Help 12 44
Read text on Table 7 29
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…

726 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