Jump to content

popup alert box - expired task


jpergega

Recommended Posts

Hi I have a alert box here that want to pop up when a user is logged into their account. The alert box will tell the user there is a expired task.

 

Here is my code but is not doing anything please could you tell me what is wrong with it? because is not showing any errors. Thanks

 

<?php
if(isset($_SESSION['account_id']))
{
$account_id = $_SESSION['account_id'];
$curdate = date('yyyy/mm/dd');
$query4 = "select finish from task WHERE account_id=$account_id";
$result4= mysqli_query($con,$query4);
while($row = mysqli_fetch_array($result4)){
if($row['finish'] == $curdate)
{
echo '<script language="javascript">alert("Your task had been expired.")</script>';
}
}
}

?>

Link to comment
Share on other sites

You should read the documentation on PHP's date() function. As you have it written right now today's date would be represented as 14141414/0303/2020

Thanks I read the date function link you provided and I have changed the date format but still nothing happened. Any other suggestions that I am doing wrong?

Link to comment
Share on other sites

where's the code you changed? We can't tell what you did wrong without it.

 

Are you checking the values of $curdate and $row['finish']? Do you know what they actually are so you can tell if they should or shouldn't be equal?

Link to comment
Share on other sites

where's the code you changed? We can't tell what you did wrong without it.

 

Are you checking the values of $curdate and $row['finish']? Do you know what they actually are so you can tell if they should or shouldn't be equal?

Earlier I changed to this $today = date("Y-m-d H:i:s");

Now I have got rid of the time $today = date("Y-m-d"); is working now Thanks

Link to comment
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
×
×
  • Create New...