Here the
reportedUser
makes no sense:
$reportsQuery = "SELECT reportedUser COUNT(*) AS count FROM duk_reports WHERE reported = :username";
If it is correct that the name of the column that contains the user name is "reported" then this should work:
$reportsQuery = "SELECT COUNT(*) AS count FROM duk_reports WHERE reported = :username";
Edit: I'm actually not sure if your database will allow you to call your result "count" because it's a keyword - you may have to call it differently:
$reportsQuery = "SELECT COUNT(*) AS countReported FROM duk_reports WHERE reported = :username";
Edit 2: $reportsOutput
is of type
PDOStatament
which is a class and not an array. Therefore you can't call the [] operator on it.
To access the query result try this:
$success = $reportsOutput->execute();
$results = $reportsOutput->fetch(PDO::FETCH_ASSOC);
echo "<td>".$results['countReported']."</td>";
cf.
http://stackoverflow.com/questions/15759223/cannot-use-object-of-type-pdostatement-as-array[
^]