我有一个多维数组。该数组类似于以下数组:
Array => [link] => http://www.theqlick.com
=> [title] => The Qlick
=> [description] A great way to connect to the Internet
=> [keywords] Search Engine, The Qlick, Noah Smith
和
Array => [link] => http://www.google.com
=> [title] => Google
=> [description] A great search engine
=> [keywords] Google, the web, search engine
对于与上述两个类似的每个数组,我希望它是 1 行。我有一个标题、关键字、描述和 URL 字段供他们输入。但它们似乎没有输入到数据库中。有任何想法吗??
$data = array();
foreach ($links as $link) {
$output = array(
"title" => Titles($link),
"link" => $link,
"description" => getMetas($link),
"keywords" => getKeywords($link)
);
if (empty($output["description"])){
$output["description"] = getWord($link);
}
$data[] = $output;
}
print_r($data);
mysql_query("INSERT INTO scan (title, url, description, keywords) VALUES ('".implode("'),('",$data)."')");
if (!mysql_query()) {
echo "woops";
}
mysql_close($connect);