我的php版本5.3.8,所以没了mssql等dll,能用的只有pdo odbc,此乃前提
try{
 $conn = new PDO("odbc:Driver={SQL Server};Server=192.168.1.1,1433;Database=master;",'sa','xuxin');
}catch(Exception $e){
 //echo "Failed: " . $e->getMessage();
 echo 'Can not connect to database!';
 die();
}
try了下,貌似能连上,修改密码神马的就会显示Can not connect to database!,顺带鄙视下端口号为毛是,。
关键问题是,我想执行个查询或者删除,sql语句如何弄呢?
对这个实在不懂
请赐教,我用这样的方法,
$sth = $pdo->prepare("select piID from CFWorkTtems");
$sth->execute();
//将整个记录集读到数组里:
$result = $pdo->fetchAll();
var_dump($result);
print_r($result);
显示Fatal error: Call to undefined method PDO::fetchAll()sqldatabasephp