Display links in sql query

0

In a database (MySQL) I have a column dedicated to electronic addresses (links). My problem is: many times the same line can have several links. I would like to include the links in the database in the same cell (Links), and in the view, make a href or something of the type, so that each link is clickable for the user, and no glue appears in the other (example: www.google.com.brwww.youtube.comwww.facebook.com ).

Any ideas on how to proceed?

    
asked by anonymous 24.04.2015 / 00:19

1 answer

1

There are several ways to do this I recommend using serialize / unserialize.

<?php

$sites = array(
    'www.google.com',
    'www.terra.com.br',
    'www.globo.com'
);

$serializado = serialize($sites);

$lista = unserialize($serializado);
var_dump($serializado);
var_dump($lista);

ex. link

Then just make a foreach to build the links

    
24.04.2015 / 00:28