SQL Array转换为基于数组的函数

时间:2013-05-13 21:05:26

标签: php mysql arrays phirehose

默认设置

$stream->setTrack (array('cookie'));

试验

$sql = "SELECT DISTINCT text FROM keywords"; $query = mysql_query($sql) or die($sql . ' - ' . mysql_error());
$keys = array();
 while ($row = mysql_fetch_array($query)) {
 $keys[] = $row[0];
}$stream->setTrack ($keys);

默认设置采用书面文字并将其放入数组中 试验设置应该从mysql表中检索一组关键字作为数组并将它们插入到函数中。

它不起作用。怎么了?

public function setTrack($trackWords)
{
$trackWords = ($trackWords === NULL) ? array() : $trackWords;
sort($trackWords); // Non-optimal, but necessary
if ($this->trackWords != $trackWords) {
  $this->filterChanged = TRUE;
}
$this->trackWords = $trackWords;
}

0 个答案:

没有答案