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!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.