PHP에서 문제가 있습니다. 모든 데이터를 보여주고 중첩 된 루프에 넣으려고했습니다. 두 번째 루프는 null 만 반환합니다. 내가 뭘 잘못했는지 모르겠다.중첩 된 while 루프가 예상대로 작동하지 않습니다.
<?php
ini_set('max_execution_time', 36000);
$con=mysqli_connect("localhost","root","XXX","YahooFin");
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result = mysqli_query($con,"show tables from yahooFin where not tables_in_yahooFin = 'nasdaqCompanyList' and not tables_in_yahooFin = 'companylist'");
while($row = mysqli_fetch_array($result)) {
$result2 = mysqli_query($con, "select * from ".$row['Tables_in_yahoofin']." where entry_date = '2013-06-03'order by entry_date asc limit 1");
while ($row2 = mysqli_fetch_array($result2)); //<== This line gives me null
{
var_dump($row2);
echo "<br>";
}
}
var_dump($row);
mysqli_close($con);
?>
검색어가 작동한다고 가정합니다. 거기에 디버깅을 추가하고 무슨 일이 일어나고 있는지 알아보십시오. mysqli_error ($ con)는 무엇을 출력합니까? – andrewsi
'tables_in_yahooFin'에서 대문자와 소문자가 일치하지 않을 수 있습니까? 두 번째 루프에서는'Tables_in_yahooFin'입니다. BTW, 결과를 '1'로 제한하면 두 번째 루프는 어떻게됩니까? – bpoiss