本人在win7里架设iis服务器,运行一个web系统,数据库用sql server 2008,由于其后台是用asp.net+C#开发,前台是用php5.4开发,因此必须保证iis里也可以运行php页面程序。看了网上很多配置,访问前台的页面跳出的结果如下:sql error!(in function select)
求各位达人怎么解决?
回复讨论(解决方案)
你至少应贴出相关的代码
你至少应贴出相关的代码
那个php前台在Apache作为服务器的时候没问题,但是放在iis里就有问题了。。。貌似不是代码的问题。不过也把代码贴出去吧。session_start();
require_once 'libs/Smarty.class.php';
require_once 'libs/SqlsrvTools.php';
$smt=new Smarty();
//{获取新闻
$typeInfoConn=new SqlsrvTools("jmgyms", "typeinfo");
$typeRes=$typeInfoConn->where("1=1")->filed("id")->select();
$typeCount=count($typeRes);
$mediaNewsConns=array();
$newsResArr=array();
// print_r($typeRes);exit;
foreach($typeRes as $k=>$v)
{
$mediaNewsConns[$k]=new SqlsrvTools("jmgyms", "industry_news");
$newsResArr[$v["id"]]=
$mediaNewsConns[$k]
->where("newstype=".$v["id"])
->filed("id,newstitle,newstype,addtime")
->order("addtime desc")
->limit(0,4,"id")
->select();
}
//释放内存
$typeInfoConn=null;
foreach($mediaNewsConns as $k=>$v)
{
$mediaNewsConns[$k]=null;
}
//循环assign
foreach($newsResArr as $k=>$v){
// echo $k."
";
// print_r($v);
foreach ($v as $kk=>$vv)
{
foreach ($vv as $kkk=>$vvv)
{
if(!is_object($vvv))
$newsResArr[$k][$kk][$kkk]=iconv("GB2312//IGNORE","UTF-8",$vvv);
else if($kkk=="addtime")
{
$jsonTemp=json_encode($vvv);
$addtimeArr=json_decode($jsonTemp,1);
$newsResArr[$k][$kk]["date"]=substr($addtimeArr['date'],0,10);
//echo $newsResArr[$k][$kk]["date"];
}
}
}
//print_r($v);
$smt->assign("newslist$k",$newsResArr[$k]);
}//exit;
//}
$linkConn=new SqlsrvTools("jmgyms","links");
$links=$linkConn->where(" 1=1 ")->filed("Title,WebUrl")->select();
// echo $linkConn->getSqlExtends();exit;
foreach ($links as $k=>$v)
{
foreach ($v as $kk=>$vv)
{
$links[$k][$kk]=iconv("GB2312//IGNORE","UTF-8",$vv);
}
}
$loginTips="";
if(isset($_SESSION["username"])){
$isLogin=true;
$loginTips="";
switch ($_SESSION['membertype']){
case 1:{
$loginTips="亲爱的个人会员";
};break;
case 2:{
$loginTips="敬爱的团体会员";
};break;
default:{
$loginTips="欢迎回来";
};
}
$smt->assign("username",$_SESSION["username"]);
}
else{
$isLogin=false;
$loginTips="会员登陆";
}
$smt->assign("links",$links);
$smt->assign("islogin",$isLogin);
$smt->assign("loginTips",$loginTips);
$smt->display('templates/index.html');
?>
那你的错误信息 sql error!(in function select) 是从哪里来的?跟踪了吗?
IIS 下的 php 应该是 FastCGI 方式,你的是吗?
如果是,那么 sqlsrv 扩展也得换吧?
Php就可以后台,你干嘛还要用c#,

ThesecrettokeepingaPHP-poweredwebsiterunningsmoothlyunderheavyloadinvolvesseveralkeystrategies:1)ImplementopcodecachingwithOPcachetoreducescriptexecutiontime,2)UsedatabasequerycachingwithRedistolessendatabaseload,3)LeverageCDNslikeCloudflareforservin

You should care about DependencyInjection(DI) because it makes your code clearer and easier to maintain. 1) DI makes it more modular by decoupling classes, 2) improves the convenience of testing and code flexibility, 3) Use DI containers to manage complex dependencies, but pay attention to performance impact and circular dependencies, 4) The best practice is to rely on abstract interfaces to achieve loose coupling.

Yes,optimizingaPHPapplicationispossibleandessential.1)ImplementcachingusingAPCutoreducedatabaseload.2)Optimizedatabaseswithindexing,efficientqueries,andconnectionpooling.3)Enhancecodewithbuilt-infunctions,avoidingglobalvariables,andusingopcodecaching

ThekeystrategiestosignificantlyboostPHPapplicationperformanceare:1)UseopcodecachinglikeOPcachetoreduceexecutiontime,2)Optimizedatabaseinteractionswithpreparedstatementsandproperindexing,3)ConfigurewebserverslikeNginxwithPHP-FPMforbetterperformance,4)

APHPDependencyInjectionContainerisatoolthatmanagesclassdependencies,enhancingcodemodularity,testability,andmaintainability.Itactsasacentralhubforcreatingandinjectingdependencies,thusreducingtightcouplingandeasingunittesting.

Select DependencyInjection (DI) for large applications, ServiceLocator is suitable for small projects or prototypes. 1) DI improves the testability and modularity of the code through constructor injection. 2) ServiceLocator obtains services through center registration, which is convenient but may lead to an increase in code coupling.

PHPapplicationscanbeoptimizedforspeedandefficiencyby:1)enablingopcacheinphp.ini,2)usingpreparedstatementswithPDOfordatabasequeries,3)replacingloopswitharray_filterandarray_mapfordataprocessing,4)configuringNginxasareverseproxy,5)implementingcachingwi

PHPemailvalidationinvolvesthreesteps:1)Formatvalidationusingregularexpressionstochecktheemailformat;2)DNSvalidationtoensurethedomainhasavalidMXrecord;3)SMTPvalidation,themostthoroughmethod,whichchecksifthemailboxexistsbyconnectingtotheSMTPserver.Impl


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Dreamweaver Mac version
Visual web development tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

Notepad++7.3.1
Easy-to-use and free code editor

WebStorm Mac version
Useful JavaScript development tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.
