asp代码改成PHP的!
<%Response.ContentType="text/xml"search=Trim(request("search"))sql="selecttop10[compC...
<%
Response.ContentType="text/xml"
search=Trim(request("search"))
sql="select top 10 [compCode] from zongdan where [compCode] like '"&search&"%' order by [ytime]"
rs.open sql,conn,1,1
str="<?xml version=""1.0"" encoding=""gb2312""?>"&vbnewline
str=str&"<root>"&vbnewline
If rs.eof Then
Else
i=1
Do While Not rs.eof
str=str&"<message id="""&i&""">"&vbnewline
str=str&" <text>"&rs("compCode")&"</text>"&vbnewline
str=str&"</message>"&vbnewline
i=i+1
rs.movenext
loop
End If
str=str&"</root>"
rs.close
response.write str
%>
把上面的ASP代码,改成PHP的!谢谢! 展开
Response.ContentType="text/xml"
search=Trim(request("search"))
sql="select top 10 [compCode] from zongdan where [compCode] like '"&search&"%' order by [ytime]"
rs.open sql,conn,1,1
str="<?xml version=""1.0"" encoding=""gb2312""?>"&vbnewline
str=str&"<root>"&vbnewline
If rs.eof Then
Else
i=1
Do While Not rs.eof
str=str&"<message id="""&i&""">"&vbnewline
str=str&" <text>"&rs("compCode")&"</text>"&vbnewline
str=str&"</message>"&vbnewline
i=i+1
rs.movenext
loop
End If
str=str&"</root>"
rs.close
response.write str
%>
把上面的ASP代码,改成PHP的!谢谢! 展开
展开全部
<?php
header('Content-type:text/xml');
$search = trim($_REQUEST['search']);
$sql = "select compCode from zongdan where compCode like '".$search."%' order by ytime limit 0,10";
$rs = mssql_query($sql);
$str = "<?xml version=\"1.0\" encoding=\"gb2312\"?>\r\n";
$str .= "<root>\r\n";
if(mssql_num_rows($rs) > 0){
$i = 1;
while($data = mssql_fetch_array($rs)){
$str .= "<message id=\"".$i."\">\r\n";
$str .= " <text>".$data['compCode']."</text>\r\n";
$str .= "</message>\r\n";
$i++;
}
}
$str .= "</root>";
mssql_free_result($rs);
mssql_close();
echo $str;
?>
我估计你用mssql,mssql连接数据库部分自已写。
header('Content-type:text/xml');
$search = trim($_REQUEST['search']);
$sql = "select compCode from zongdan where compCode like '".$search."%' order by ytime limit 0,10";
$rs = mssql_query($sql);
$str = "<?xml version=\"1.0\" encoding=\"gb2312\"?>\r\n";
$str .= "<root>\r\n";
if(mssql_num_rows($rs) > 0){
$i = 1;
while($data = mssql_fetch_array($rs)){
$str .= "<message id=\"".$i."\">\r\n";
$str .= " <text>".$data['compCode']."</text>\r\n";
$str .= "</message>\r\n";
$i++;
}
}
$str .= "</root>";
mssql_free_result($rs);
mssql_close();
echo $str;
?>
我估计你用mssql,mssql连接数据库部分自已写。
Storm代理
2023-08-29 广告
2023-08-29 广告
"StormProxies是全球大数据IP资源服务商,其住宅代理网络由真实的家庭住宅IP组成,可为企业或个人提供满足各种场景的代理产品。点击免费测试(注册即送1G流量)StormProxies有哪些优势?1、IP+端口提取形式,不限带宽,I...
点击进入详情页
本回答由Storm代理提供
展开全部
<?php
header("Content-type: text/html");
$search = trim($_REQUEST['search']);
$sql = "select [compCode] from zongdan where [compCode] like '$search%' order by [ytime] limit 0,10";
$obj = new compService(); //数据库操作类。自己写
$arrs = $obj->getComp($sql);
$str="<?xml version=""1.0"" encoding=""gb2312""?>"&vbnewline;
$str=$str&"<root>"&vbnewline;
$i=0;
foreach($arrs as $a){
$str=$str&"<message id=$i>"&vbnewline ;
$str=$str&" <text>"&$rs("compCode")&"</text>"&vbnewline;
$str=$str&"</message>"&vbnewline;
}
echo $str;
header("Content-type: text/html");
$search = trim($_REQUEST['search']);
$sql = "select [compCode] from zongdan where [compCode] like '$search%' order by [ytime] limit 0,10";
$obj = new compService(); //数据库操作类。自己写
$arrs = $obj->getComp($sql);
$str="<?xml version=""1.0"" encoding=""gb2312""?>"&vbnewline;
$str=$str&"<root>"&vbnewline;
$i=0;
foreach($arrs as $a){
$str=$str&"<message id=$i>"&vbnewline ;
$str=$str&" <text>"&$rs("compCode")&"</text>"&vbnewline;
$str=$str&"</message>"&vbnewline;
}
echo $str;
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2011-01-08
展开全部
太深奥
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询