問題タブ [mysqli-fetch-array]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
php - 致命的なエラー: Uncaught TypeError: mysqli_fetch_array(): Argument #1 ($result) must be of type mysqli_result, bool... but array returns true?
30 日間の平均ボリュームを返すはずの php-mysql コードがありますが、それを実行するたびに、キャッチされないタイプ エラーが発生します。デバッグ時に、配列が true として返されるように見えます。また、phpadmin/mysql で同じクエリを実行すると、1900 以上の結果が返されます。助けが要る...
エラーは、「while($row=mysqli_fetch_array($result))」行に対するものです。
私が得ている出力は次のとおりです。
SELECT ticker,AVG(volume) as AVGVol FROM historyprice WHERE (pricedate>='2022-01-31') GROUP BY ticker
object(mysqli_result)#2 (5) { ["current_field"]=> int(0) ["field_count"]=> int(2) ["lengths"]=> NULL ["num_rows"]=> int(1987 ) ["型"]=> int(0) }
致命的なエラー: Uncaught TypeError: mysqli_fetch_array(): Argument #1 ($result) must be of type mysqli_result, bool given in [file]:24 Stack trace: #0 file: mysqli_fetch_array(true) #1 {main} throw in [ファイル] 24行目
ありとあらゆるアイデアが役に立ちます。