我是 php 新手,我已经下载了 Contus groupclone 无效代码。我连接到 mysql 数据库,但是当我想运行它时,我得到了这个错误。我的本地服务器是 wamp 2.2 并在 windows vista 上使用 apache 2.2.21 、 php 5.3.8 和 mysql 5.5.16 。如果有人可以帮助我,我将不胜感激。
public function urlCollections()
{
if ($this->isLicense() === true) {
$attribute = Mage::getmodel("eav/config")->getAttribute("catalog_product", "562");
$cityValue = array();
* foreach ($attribute->getSource()->getAllOptions(true, true) as $option) {*
$cityValue[$option['label']] = $option['value'];
$storeId = Mage::app()->getStore()->getStoreId();
$city = $option['value'];
if ($city != "") {
$cityName = $option['label'];
$cityName = ereg_replace("[^A-Za-z0-9^-]", "", $cityName);
$cityName = str_replace(" ", "-", $cityName);
$cityName = strtolower($cityName);
$requestPath = "deal/" . $cityName . ".html";
$realPath = "deal/index/index/city/" . $city;
$resource = Mage::getsingleton("core/resource");
$read = $resource->getConnection("read");
$tPrefix = ( boolean ) Mage::getconfig()->getTablePrefix();
$rewriteTable = "magentocore_url_rewrite";
$idPath = "deal/index/index/city/" . $city;
$urlRewrite = $read->select()->from(array(
"ur" => $rewriteTable
), array(
"ur.request_path"
))->where("ur.id_path =? ", $idPath)->where("ur.store_id =? ", $storeId)->where("ur.is_system =?", 0);
$cityUrl = $read->fetchRow($urlRewrite);
if (empty($cityUrl)) {
$urlCheck = $read->select()->from(array(
"ur" => $rewriteTable
), array(
"ur.request_path"
))->where("ur.request_path =? ", $requestPath)->where("ur.store_id =? ", $storeId)->where("ur.is_system =?", 0);
$cityUrlCheck = $read->fetchRow($urlCheck);
if (!empty($cityUrlCheck)) {
$requestPath = "deal/" . $cityName . "-" . $city . ".html";
}
$executeQuery = $read->query("INSERT INTO {$rewriteTable} (`store_id`, `category_id`, `product_id`, `id_path`, `request_path`, `target_path`, `is_system`, `options`, `description`) VALUES ({$storeId}, NULL, NULL, '{$realPath}', '{$requestPath}', '{$realPath}', '0', '', NULL)");
}
}
}
return $cityValue;
}
}