![](/img/trans.png)
[英]Why does php ldap_search return different attributes within the same query?
[英]Why does this query return different values?
我正在嘗試從數據庫中提取信息,但是我正在使用的查詢僅提取第一個之后的所有值。 我沒有設置LIMIT
,但我確實嘗試設置了LIMIT 0,30
,沒有任何變化。 在phpMyAdmin中,查詢返回我期望的結果。 在我的PHP文件中,它返回我所解釋的內容。
查詢是:
SELECT * FROM `mainSite_others` WHERE forGame='$gameName'
gameName
是先前提供的,我懷疑沒有錯誤,因為它確實返回至少兩個值。 數據庫中的forGame值都是相同的,一個常量"+Stellar+Dawn"
。
PHP代碼是:
while ($gameOther = $database->fetchArray($gameOtherQry)) {
echo $gameOther['otherName'];
}
不用擔心$database->fetchArray
部分,那只是我的數據庫類,據我所知,它可以正常工作。
我從中提取的表如下所示(包含所有值):
id | forGame | otherType | otherName | otherDesc
9 | +Stellar+Dawn | Character | Car | Car
10 | +Stellar+Dawn | Item | Brugson Burson | a guy
11 | +Stellar+Dawn | Item | Space Pie | A pie from space
我正在使用mySQLi。
有任何想法嗎? 謝謝。
在到達while循環之前,您可能正在進行訪存調用,這會“丟失”結果的第一行。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.