我最近听说很快 PHP 将弃用所有传统的 mysql 函数(例如:mysql_query()、mysql_num_rows() 等...)。话虽如此,我正在尝试将所有查询转换为 PDO 格式。这个特殊情况给我带来了一些困难,
$team = $_GET['team'];
$ncaa = array("Duke", "Harvard", "Yale", "Stanford");
$limit = idate('z')+14;
$list = join("','", $ncaa);
$query = "SELECT game_id
FROM ncaa_current_season_games
WHERE game_date_int >= :game_date_int
AND (home_team = :team OR away_team = :team)
AND home_team IN(:list)
AND away_team IN(:list)
ORDER BY game_date_int ASC
LIMIT 1";
$stmt = $db->prepare($query);
$stmt->execute(array(':game_date_int' => $limit, ':team' => $team, ':list' => $list));
$num = $stmt->rowCount();
$num 返回为 0。当我以旧格式(不是 PDO)进行查询时,它工作得很好。
有什么建议么?
谢谢,
槊