We help IT Professionals succeed at work.
Get Started

Alter PHP code to include PHP echo variable

pda4me
pda4me asked
on
352 Views
Last Modified: 2012-05-12
I have a PHP variable like this:
<?php echo($row['PHOTO_URL']); ?>

I have another variable like this that signifies the amount of photos:
<?php echo($row['PHOTO_QUANTITY']); ?>

The actual photo URL looks like this:
http://extimages2.living.net/ImagesHomeProd3/FL/idx/photos/ftmyersbeach/78/201008226.jpg

When the PHOTO_QUANTITY is any value more than one, it means a new URL starting with a _2.jpg and so forth is appended to the PHOTO_URL like this:
http://extimages2.living.net/ImagesHomeProd3/FL/idx/photos/ftmyersbeach/78/201008226_2.jpg 
http://extimages2.living.net/ImagesHomeProd3/FL/idx/photos/ftmyersbeach/78/201008226_3.jpg
http://extimages2.living.net/ImagesHomeProd3/FL/idx/photos/ftmyersbeach/78/201008226_4.jpg
etc., etc.

How do create an IF statement or something along those lines that uses the PHOTO_QUANTITY value to display thumbnails of these photos dynamically.  The PHOTO_QUANTITY is not constant so hardcoding will not work.
Comment
Watch Question
Commented:
This problem has been solved!
Unlock 1 Answer and 10 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE