-2

I have column in mysql where are some words.
For example word,dog,cat,tree..

Is it possible to create php array like this?

$array=array("word","dog","cat","tree");
4

2 に答える 2

3

You can simply use php explode() function

$row=mysql_fetch_assoc($result);
or 
$row=$pdo->fetch(PDO::FETCH_ASSOC);

$newarray=explode(",",$row["data"]);
于 2012-10-08T15:31:47.143 に答える
3

You mean you want to split them by commas? Use explode:

$items = explode(',', $columnValue);
于 2012-10-08T15:31:47.487 に答える