1
나는 스포츠, 지역, 국가 및 리그의 참조 ID를 포함하는 행이있는 테이블 matches
을 가지고 있습니다. 모든 경기가 리그 ID를 가지고있는 것은 아니기 때문에 LEFT JOIN
을 사용하여 실제 리그 이름을 찾습니다.MySQLi fetch를 사용하는 PHP가 NULL이있는 행을 반환하지 않습니다. LEFT JOIN
$stmt = $mysqli->prepare("
SELECT leagues.name, matches.league
FROM matches
LEFT JOIN leagues
ON leagues.short = matches.league
WHERE leagues.lang = ? AND matches.sport = ? AND matches.region = ? AND matches.country = ?
ORDER BY leagues.name ASC");
$stmt->bind_param('ssss',$lang,$sport_short,$region_short,$country_short);
$stmt->execute();
$stmt->store_result();
$stmt->bind_result($league,$league_short);
나는이 점 사용에 var_dump($league)
또는 var_dump($league_short)
은 내가 NULL
값을 볼 경우
나는 다음과 같은 사용합니다. 그러나 while ($stmt->fetch) {...}
행을 가져 오려고 시도한 후에 NULL
행을 포함시키지 않으면 무엇이 누락됩니까?