Jump to content

[SOLVED] MySQL query exploding to seperate links


freelancer

Recommended Posts

Hello!

 

I have form where I enter for example picture file names like this: test1.jpg, test2.jpg, test3.jpg etc. Now on page where I want these images to be displayed I need to explode them so let's say I have $picture[0], $picture[1], $picture[2] etc. My question and problems that how I can make them appear as seperate links depening on how many pictures were exploded to variables so i.e. when I have 2 images names in sql table then on my web it displays like www.test.com/test1.jpg, www.test.com/test2.jpg etc.

 

Maybe explode isn't only solution and there could be any other ways to do it.

 

Hope you understand my point and can help me!

explode will work.

 

<?php

$pics = explode(',', $_GET['pics']);

$NumberOfPictures = count($pics);

$location = 'http://www.YourWebSite.com/pictures/';

for ( $i = 0; $i < $NumberOfPictures; $i++ )
  {
      echo $location . $pics[$i] . '<br>';
  }

?>

 

that would echo out a link for each picture, but i'm not completely sure that's what you were asking, it wasn't very clear.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.