Salut, j'ai une table où je suis à la recherche de recherche précédent record avec le temps j'ai selectbox avec option de recherche est ici le codeRECHERCHE PAR date et l'heure selectbox
if (isset($_REQUEST['searchtype']) && isset($_REQUEST['period']))
{
if ($_REQUEST['searchtype'] == "All")
{
$period = "All";
}
elseif ($_REQUEST['searchtype'] == "Last24hours")
{
$period = date('Y-m-d H:i:s')-86400;
}
elseif ($_REQUEST['searchtype'] == "Last10days")
{
$period = date('Y-m-d H:i:s')-864000;
}
elseif ($_REQUEST['searchtype'] == "LastHour")
{
$period = date('Y-m-d H:i:s')-3600;
}
elseif ($_REQUEST['searchtype'] == "Lastweek")
{
$period = date('Y-m-d H:i:s')-604800;
}
elseif ($_REQUEST['searchtype'] == "LastMonth")
{
$period = date('Y-m-d H:i:s')-2592000;
}
else
{
$period = $_REQUEST['searchtype'];
}
comment pourrais-je faire cela. ..
ne peut pas vous mettre juste la valeur de sélectionner des options à 86400, 86400 ..... –
utilisation 'strtotime' pour générent facilement les horodatages – mithunsatheesh