代码如下
<?php
$odbcDsn="StutInfo";
$odbcUser="";
$odbcPass="";
$conn=odbc_connect($odbcDsn,$odbcUser,$odbcPass);
$name=$_POST["txtName"];
$sql = "SELECT usermsg.id AS usermsg_id, usermsg.name, Performance.id AS Performance_id, Speech.id AS Speech_id, others.id AS others_id
FROM ((usermsg LEFT JOIN Performance ON usermsg.id=Performance.id) LEFT JOIN Speech ON usermsg.id=Speech.id) LEFT JOIN others ON usermsg.id=others.id where usermsg.name =$name";
$tmpPerformanceID="";
$tmpOtherID="";
$tmpSpeechID="";
$tmpusermsg="";
$tmpName="";
$query = odbc_do($con,$sql);
while(odbc_fetch_row($query)){
$tmpusermsg = odbc_result($query,1);
$tmpName = odbc_result($query,2);
$tmpPerformanceID = odbc_result($query,3);
$tmpSpeechID = odbc_result($query,4);
$tmpOtherID = odbc_result($query,5);
}
?>
运行后错误信息
Warning: odbc_connect() [function.odbc-connect]: SQL error: Failed to fetch error message, SQL state HY000 in SQLConnect in C:\Inetpub\wwwroot\search_result.php on line 18
Warning: odbc_do(): supplied argument is not a valid ODBC-Link resource in C:\Inetpub\wwwroot\search_result.php on line 27
Warning: odbc_fetch_row(): supplied argument is not a valid ODBC result resource in C:\Inetpub\wwwroot\search_result.php on line 28odbc已经绑定
<?php
$odbcDsn="StutInfo";
$odbcUser="";
$odbcPass="";
$conn=odbc_connect($odbcDsn,$odbcUser,$odbcPass);
$name=$_POST["txtName"];
$sql = "SELECT usermsg.id AS usermsg_id, usermsg.name, Performance.id AS Performance_id, Speech.id AS Speech_id, others.id AS others_id
FROM ((usermsg LEFT JOIN Performance ON usermsg.id=Performance.id) LEFT JOIN Speech ON usermsg.id=Speech.id) LEFT JOIN others ON usermsg.id=others.id where usermsg.name =$name";
$tmpPerformanceID="";
$tmpOtherID="";
$tmpSpeechID="";
$tmpusermsg="";
$tmpName="";
$query = odbc_do($con,$sql);
while(odbc_fetch_row($query)){
$tmpusermsg = odbc_result($query,1);
$tmpName = odbc_result($query,2);
$tmpPerformanceID = odbc_result($query,3);
$tmpSpeechID = odbc_result($query,4);
$tmpOtherID = odbc_result($query,5);
}
?>
运行后错误信息
Warning: odbc_connect() [function.odbc-connect]: SQL error: Failed to fetch error message, SQL state HY000 in SQLConnect in C:\Inetpub\wwwroot\search_result.php on line 18
Warning: odbc_do(): supplied argument is not a valid ODBC-Link resource in C:\Inetpub\wwwroot\search_result.php on line 27
Warning: odbc_fetch_row(): supplied argument is not a valid ODBC result resource in C:\Inetpub\wwwroot\search_result.php on line 28odbc已经绑定
解决方案 »
- 急切求个php调用java写的web service实例
- 正则 提取超链接信息 问题
- 为什么修改了php.ini的mssql.textsize = 2147483647不管用
- 从零开始建网站
- 我的这个网页为什么在文本框内按enter后自动提交啊???
- mysql_connect()问题!
- php4+apache+mysql在2000下配置运行出现的问题,急等解决
- 请问 以PHP+MYSQL 开发的网络数据库怎么样实现 数据备份 的??
- php新手请教计算总和问题!
- win8.1 专业版 64位 (PHP5.4.33) (没有使用wampserver)redis扩展无法生效
- 请问PHP网页的点击按钮打开网页代码如何写?
- php能实现两台服务器上传输数据?
http://www.9enjoy.com/post/226/