AS
結果を処理できるように、mySQLステートメントの変数を変数に割り当てようとしています。ただし、これらの変数にを割り当てることはできません。
mySQLSELECT
ステートメントは次のとおりです
$sql = "SELECT min(ups) AS minups, max(ups) AS maxups, min(downs) AS mindowns, max(downs) AS maxdowns, min(score) AS minscore, max(score) AS maxscore, min(comments) AS mincomments, max(comments) AS maxcomments, min(totalVotes) AS mintotalvotes, max(totalVotes) AS maxtotalvotes FROM reddit WHERE movie = ':movie'";
$stmt = $conn->prepare( $sql );
$stmt->bindValue( ":movie", $redditMovies->reddit, PDO::PARAM_INT );
$stmt->execute();
$row = $stmt->fetch();
私はそれらをこれらの変数に割り当てようとしています
$minups = $row ['minups'];
$maxups = $row ['maxups'];
$rups = (int)($maxups - $minups);
print_r($rups);
$mindowns = $row ['mindowns'];
$maxdowns = $row ['maxdowns'];
$rdowns = (int)($maxdowns - $mindowns);
$minscore = $row ['minscore'];
$maxscore = $row ['maxscore'];
$rscore = (int)($maxscore - $minscore);
$mincomments = $row ['mincomments'];
$maxcomments = $row ['maxcomments'];
$rcomments = (int)($maxcomments - $mincomments);
$mintotalvotes = $row ['mintotalvotes'];
$maxtotalvotes = $row ['maxtotalvotes'];
$rtotalvotes = (int)($maxtotalvotes - $mintotalvotes);
この問題を解決するには何を変更する必要がありますか?