select语句的循环结果抛出错误

时间:2015-05-17 19:32:56

标签: php sqlsrv

    <?php
include 'config.php';
$query = sqlsrv_query($conn1, "SELECT * FROM dnmembership.[dbo].DNAuth a JOIN dnworld.[dbo] Characters b ON a.CharacterID = b.CharacterID where a.CertifyingStep = 2");

while($row = sqlsrv_fetch_array($query,SQLSRV_FETCH_ASSOC)){
echo $row['CharacterName']. '<br/>';
}
?>

此代码符合以下错误代码: 警告:sqlsrv_fetch_array()要求参数1为资源,第5行的C:\ xampp \ htdocs \ usersonline.php中给出布尔值

任何人都知道为什么?

1 个答案:

答案 0 :(得分:0)

您错过.[dbo]之间的句点Characters

SELECT * 
FROM   dnmembership.[dbo].DNAuth a 
JOIN   dnworld.[dbo].Characters b ON a.CharacterID = b.CharacterID 
------------- Here -^
WHERE  a.CertifyingStep = 2