win7中IIS+php+Sql2008的错误
本人在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#,

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

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

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Alipay PHP...

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

The application of SOLID principle in PHP development includes: 1. Single responsibility principle (SRP): Each class is responsible for only one function. 2. Open and close principle (OCP): Changes are achieved through extension rather than modification. 3. Lisch's Substitution Principle (LSP): Subclasses can replace base classes without affecting program accuracy. 4. Interface isolation principle (ISP): Use fine-grained interfaces to avoid dependencies and unused methods. 5. Dependency inversion principle (DIP): High and low-level modules rely on abstraction and are implemented through dependency injection.

How to automatically set the permissions of unixsocket after the system restarts. Every time the system restarts, we need to execute the following command to modify the permissions of unixsocket: sudo...

How to debug CLI mode in PHPStorm? When developing with PHPStorm, sometimes we need to debug PHP in command line interface (CLI) mode...

Article discusses late static binding (LSB) in PHP, introduced in PHP 5.3, allowing runtime resolution of static method calls for more flexible inheritance.Main issue: LSB vs. traditional polymorphism; LSB's practical applications and potential perfo

Sending JSON data using PHP's cURL library In PHP development, it is often necessary to interact with external APIs. One of the common ways is to use cURL library to send POST�...

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.
