I'm a beginner trying to query a table in my wordpress database and would appreciate some pointers on where I'm going wrong... I've got a table of cricket statistics, and want to get the highest score from a column.
The code is below, and when I include $wpdb->show_errors();
, I get: WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1]
The data type of the Runs_1 column is int
<?php
$top_score = $wpdb->get_var (" SELECT MAX(Runs_1) FROM $wpdb->Bangalore") ;
echo "<p>Top first innings score is {$top_score} </p>";
?>
Any help would be much appreciated.