Imagine my Mysql Tbl looks like this:
Item|Score
cam|2
car|5
window|1
glass|4
Now, I want php mysqli to present rows who's values (in the score column) are greater than "1". From our example, I want it presented like this:
Item|Score
car|5
glass|4
cam|2
NOTE: The row "window|1" has not been presented since it's value in the score column is not greater than "1".
Question 1: Is there a simple way to achieve my purpose without any Groupings done on the Mysql query ? If so, how ? What would be the Mysql query and what would the php code (Prepared Statements) be when using the Mysqli extension ?
I do not think the following are accurate. Hence, I need your professional inputs.
1st ATTEMPT:
$score = >1;
$query = "SELECT item, score FROM tbl WHERE score = ? ORDER by score DESC";
$stmt = mysqli_prepare($conn,$query);
mysqli_stmt_bind_param($stmt,'i',$score);
mysqli_stmt_execute($stmt);
$result = mysqli_stmt_bind_result($stmt,$item, $db_score);
mysqli_stmt_fetch($stmt);
mysqli_stmt_free_result($stmt);
2nd ATTEMPT:
$score = >1;
$query = "SELECT item, score FROM tbl WHERE score > ? ORDER by score DESC";
$stmt = mysqli_prepare($conn,$query);
mysqli_stmt_bind_param($stmt,'i',$score);
mysqli_stmt_execute($stmt);
$result = mysqli_stmt_bind_result($stmt,$item, $db_score);
mysqli_stmt_fetch($stmt);
mysqli_stmt_free_result($stmt);