1 回答
TA贡献1851条经验 获得超5个赞
你应该阅读: wpdb::p repare( string $query, mixed $args )
代码应该看起来像这样(未经测试,我没有一个wordpress可以测试):
global $wpdb;
//$now = date("Y-m-d H:i:s");
$params = array("%".$searchFor."%", $searchDate, $searchTz);
$sql = "SELECT se.*, ss.showName, TIMEDIFF(NOW(), UTC_TIMESTAMP) as server_date
FROM showpress_episodes
AS se LEFT JOIN showpress_shows AS ss
ON se.showId=ss.id
WHERE ss.showName LIKE %s
AND DATE(episodeStartTime) = CURRENT_DATE() + INTERVAL %d DAY
AND episodeStartTime >= NOW() - INTERVAL %d HOUR
ORDER BY episodeStartTime
";
$result = $wpdb->get_results($wpdb->prepare($sql, $params), ARRAY_A);
- 1 回答
- 0 关注
- 101 浏览
添加回答
举报