Mysql_query help

Discussion in 'PHP' started by baris22, Feb 16, 2007.

  1. #1
    Hello,

    I have got a field in mysql. There is <br> after each entry.
    The first entry is a link for an image all the time.

    So in the row it looks like this

    http://www.google.com/a.gif<br>http://www.yahoo.com<br>http://www.aa.com<br>

    Ofcourse the links changes for every row. But the first entry is an image file with bmp, gif and jpg extantion at all the time.

    Is it possible to disregard the first data in this row when i display the results.
    I mean i do not want to show the first data which is the link of the image.

    Instead of showing

    http://www.google.com/a.gif
    http://www.yahoo.com
    http://www.aa.com

    in the results, I want to show

    http://www.yahoo.com
    http://www.aa.com

    Thank you all.
     
    baris22, Feb 16, 2007 IP
  2. Choller

    Choller Peon

    Messages:
    388
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    
    
    $string = 'http://www.google.com/a.gif<br>http://www.yahoo.com<br>http://www.aa.com<br>' ;
    $str_arr = explode('<br>',$string);
    unset($str_arr[0]);
    foreach ($str_arr as $input){
    	echo $input;
    }
    
    PHP:
    Instead of the unset statement you can also use
    array_shift($str_arr);
    PHP:
     
    Choller, Feb 16, 2007 IP
  3. baris22

    baris22 Active Member

    Messages:
    543
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    60
    #3
    Thank you. it worked


     
    baris22, Feb 16, 2007 IP