i have to find max value from database. for this purpose i have used max() with where clause but when i echo the result then i get this error.
Catchable fatal error: Object of class mysqli_result could not be converted to string in
i have searched alot and tried this,, this and this and some of others but found nothing helpfull...
my code is :
include('connection.php'); $qry = "SELECT MAX(week) FROM reservation WHERE status= 1" ; $result = mysqli_query($connection,$qry2); echo $result ;
on the same page other query is working fine but this one is not..
what i want :
basically i want to get the maximum week number where status is = 1
Hope this helps you
$result = mysqli_query("SELECT MAX(week) AS max_week reservation WHERE status= 1"); $row = mysqli_fetch_array($result); echo $row["max_week"];