本文介绍了代码未在浏览器中运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<?php
ini_set("memory_limit","1024M");
set_time_limit(0);
$link=mysql_connect('localhost','root','youmint');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
mysql_select_db('ajay_wp');
require("xml.class.php");
require_once("couponfunction.php");
$ObjCoupon= new Addcoupons();
$ObjXML = new XML();
$ArrField = array();
$Field='merchantid,merchantname,merchanturl,merchantlogo,merchantsmalllogo,offerset';
if(isset($Field) && $Field != '' ) {
$Field = $Field;
$ArrField = explode(',' , $Field);
}
$AllCoupon = $ObjXML->GetCouponFromXML($ArrField, 'http://www.saverr.com/webservicexml/xml/addedofferxml.xml');
echo '<pre>';
print_r($AllCoupon);
die;
$tc=count($AllCoupon);
foreach($AllCoupon as $coupondata)
{
$cd =explode('~~',$coupondata);
$Merchantid =$cd[0];
$merchantname =$cd[1];
$merchanturl =$cd[2];
$merchantlogo =$cd[3];
$merchantsmalllogo =$cd[4];
$OfferDetails =$cd[5];*/
preg_match_all("/<offerID>(.*?)<\/offerID>/s",$OfferDetails,$offerid);
preg_match_all("/<offerName>(.*?)<\/offerName>/s",$OfferDetails,$offerName);
preg_match_all("/<offerDescription>(.*?)<\/offerDescription>/s",$OfferDetails,$offerDescription);
preg_match_all("/<couponCode>(.*?)<\/couponCode>/s",$OfferDetails,$couponCode);
preg_match_all("/<offerType>(.*?)<\/offerType>/s",$OfferDetails,$offerType);
preg_match_all("/<offercategory>(.*?)<\/offercategory>/s",$OfferDetails,$offercategory);
preg_match_all("/<offerTags>(.*?)<\/offerTags>/s",$OfferDetails,$offerTags);
preg_match_all("/<offerAmount>(.*?)<\/offerAmount>/s",$OfferDetails,$offerAmount);
preg_match_all("/<offerPercentAmount>(.*?)<\/offerPercentAmount>/s",$OfferDetails,$offerPercentAmount);
preg_match_all("/<offerAddedDate>(.*?)<\/offerAddedDate>/s",$OfferDetails,$offerAddedDate);
preg_match_all("/<offerStartDate>(.*?)<\/offerStartDate>/s",$OfferDetails,$offerStartDate);
preg_match_all("/<offerEndDate>(.*?)<\/offerEndDate>/s",$OfferDetails,$offerEndDate);
preg_match_all("/<offerUrl>(.*?)<\/offerUrl>/s",$OfferDetails,$offerUrl);
for($i=0;$i<count($offerid[1]);$i++)
{
$Merchantid=$Merchantid;
$Merchantname=addslashes($merchantname);
$Merchanturls=$merchanturl;
$Merchantlogo=$merchantlogo;
$merchantSmalllogo=$merchantsmalllogo;
$offerIds=$offerid[1][$i];
$offername=addslashes($offerName[1][$i]);
$offerDesc=addslashes($offerDescription[1][$i]);
$couponCodes=$couponCode[1][$i];
$offerTypes=$offerType[1][$i];
$offerCategories=addslashes($offercategory[1][$i]);
$offerTag=addslashes(htmlentities($offerTags[1][$i]));
$offerAmounts=$offerAmount[1][$i];
$offerPercentAmount=addslashes($offerPercentAmount[1][$i]);
$offerAddedDates=$offerAddedDate[1][$i];
$offerStartDates=$offerStartDate[1][$i];
$offerEndDates=$offerEndDate[1][$i];
$offerUrls=addslashes($offerUrl[1][$i]);
if(!empty($offerIds)){
mysql_query("INSERT INTO `addedallcoupons` (`pid`, `Merchantid`, `Merchantname`, `Merchanturls`, `Merchantlogo`, `merchantSmalllogo`, `offerIds`, `offername`, `offerDesc`, `couponCodes`, `offerTypes`, `offerCategories`, `offerTag`, `offerAmounts`, `offerPersentAmount`, `offerAddedDates`, `offerStartDates`, `offerEndDates`, `offerUrls`,`postid`) VALUES (NULL, '$Merchantid', '$merchantname', '$merchanturl', '$merchantlogo', '$merchantSmalllogo', '$offerid', '$offerName', '$offerDescription', '$couponCode', '$offerType', '$offercategory', '$offerTags', '$offerAmount', '$offerPercentAmount', '$offerAddedDate', '$offerStartDate', '$offerEndDate', '$offerUrl',0)");
}
}
}
//Insert into Post
$allcoupon=mysql_query("SELECT * FROM `addedallcoupons` where `postid`=0");
while($allcouponArray=mysql_fetch_array($allcoupon))
{
$offerid=$allcouponArray['offerIds'];
$title=$allcouponArray['offername'];
$store=$allcouponArray['Merchantname'];
$offertype=$allcouponArray['offerTypes'];
$description=$allcouponArray['offerDesc'];
$merchanturl=$allcouponArray['offerUrls'];
$imagesrc=$allcouponArray['Merchantlogo'];
$code=$allcouponArray['couponCodes'];
$startdate=$allcouponArray['offerStartDates'];
$enddate=$allcouponArray['offerEndDates'];
$catname=$allcouponArray['offerCategories'];
$taxonomyidArray=$ObjCoupon->TaxonomyIdArray($catname);
$taxonomystoreidArray = $ObjCoupon->TaxonomyIdStoreArray($store);
$postid=$ObjCoupon->InsertCoupons($taxonomyidArray,$taxonomystoreidArray ,$offerid,$title,$offertype,$description,$merchanturl,$imagesrc,$code,$startdate,$enddate);
if($postid!=0){
mysql_query("update `addedallcoupons` set `postid`=$postid where `offerId`=$offerid");
}
}
问题是我已经将数据加载到phpadmin并且在将代码连接到sql并在浏览器上显示这个问题时出现问题!需要帮助!!
problem is that i have loaded the data into phpadmin and having problems in connecting code to sql and displaying this on browser!! help needed!!
推荐答案
这篇关于代码未在浏览器中运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!