Jump to content
Killersites Community
Sign in to follow this  

How To Fetch Not Last Row Of Table But Last Entry Of Certain User In The Table?

Recommended Posts

Php Experts,

I need to fetch not the last row in the table but the last entry based on a condition. I only know how to fetch the last row in the table. 

I tried coding the way I think it is done but no luck. Googled but no luck. 

$query_for_today_date_and_time = "SELECT date_and_time FROM logins WHERE username = ? ORDER BY id DESC LIMIT 1"; 
        if($stmt_for_today_date_and_time = mysqli_prepare($conn,$query_for_today_date_and_time)) 
            $result_for_today_date_and_time = mysqli_stmt_bind_result($stmt_for_today_date_and_time,$db_today_date_and_time); 
            $today_date_and_time = $db_today_date_and_time; 
            die("<h1 style=\"font-family:courier; color:red; text-size:25%; text-align:center\"><b> 
            ERROR STATEMENT 11: Sorry! Our system is currently experiencing a problem! </b></h1> <br> 

Edited by saversites

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this