MySQL Forums
Forum List  »  Newbie

Re: Please i need help on mysql on how to get last dates base on DATETIME
Posted by: Ricky Nkansah
Date: January 12, 2015 04:29PM

its gives me all the data not that last 12 hours

$q = mysqli_query($dbc,"SELECT SUM(room_price) AS total FROM booking_tbl WHERE date >= subdate( date, interval '12' hour )");

           while ($data = mysqli_fetch_assoc($q)) {

                echo $data['total'];
           }


Options: ReplyQuote


Subject
Written By
Posted
Re: Please i need help on mysql on how to get last dates base on DATETIME
January 12, 2015 04:29PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.