该页面当前未显示输出。当我说一个URL:/example.php?ID = 2
我认为问题是由于使用PDO时出错,因为在MySQL中使用SQL语句时我会收到输出。
代码:
<?php
$pdo=new PDO("mysql:dbname=createyo_TestDatabase;host=localhost","createyo_james","password");
$statement=$pdo->prepare("SELECT * FROM Edits WHERE ID = :ID AND NOT Headline = "" ORDER BY Rep DESC");
$statement->bindValue(':ID', (int) trim($_GET['ID']), PDO::PARAM_INT);
$statement->execute() or die(print_r($statement->errorInfo()));
$results = $statement->fetchAll(PDO::FETCH_ASSOC);
$json=json_encode($results);
print $json;
?>