Click to See Complete Forum and Search --> : how to use split()....??


spliff
03-03-2008, 04:12 AM
hey

i have a field in a mysql table that has the following value:

301, 502, 210, 240

i want to take the data from this table (this much php i know ;)) and then turn it into the following html:

<a href="http://www.mydomain.com/301.html">301</a><br>
<a href="http://www.mydomain.com/502.html">502</a><br>
<a href="http://www.mydomain.com/210.html">210</a><br>
<a href="http://www.mydomain.com/240.html">240</a><br>

I am guessing i will need to use split and loop, but how?

the-ferret
03-03-2008, 07:29 AM
off the top of my head why not something like

$arr = explode(",", $result);
foreach($arr as $e)
{
echo "www.yoururl.com/$e.html";

}

check the syntax as I am on a conf call typing this