Home  >  Article  >  Backend Development  >  while($row = sqlsrv_fetch_array($query)),该怎么解决

while($row = sqlsrv_fetch_array($query)),该怎么解决

WBOY
WBOYOriginal
2016-06-13 12:08:201296browse

while($row = sqlsrv_fetch_array($query))

<?PHP<br />$serverName = "localhost"; //数据库服务器地址<br /><br />$uid = "sa"; //数据库用户名<br /><br />$pwd = "66"; //数据库密码<br /><br />$connectionInfo = array("UID"=>$uid, "PWD"=>$pwd, "Database"=>"test");<br /><br />$conn = sqlsrv_connect( $serverName, $connectionInfo);<br /><br />if( $conn == false)<br /><br />{<br />     echo "连接失败!";<br /><br />    die( print_r( sqlsrv_errors(), true));<br />}<br />else<br />{<br />	echo "连接成功";<br />//执行有结果集的SQL语句<br /><br />	$query = sqlsrv_query($conn, "select ID,NAME from stuff");<br /><br />	while($row = sqlsrv_fetch_array($query))<br />	{<br />    echo $row[0]."-----".$row[1]."<br/>";<br /><br />	}<br />	sqlsrv_close( $conn);<br /><br />}


------解决思路----------------------
28 行的 echo 前面是全角空格

代码是网上复制来的吧?

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn