Php 检查用户订阅是否处于日期-不工作
我当前在登录脚本中有此代码,用于检查用户订阅是否已过期:Php 检查用户订阅是否处于日期-不工作,php,mysql,Php,Mysql,我当前在登录脚本中有此代码,用于检查用户订阅是否已过期: // get the current date $now = date("Y-m-d"); if ($user_id['enddate'] < $now) { ?> <p>your Licence is out of date</p> <?php } else { ?> <p>your l
// get the current date
$now = date("Y-m-d");
if ($user_id['enddate'] < $now) {
?>
<p>your Licence is out of date</p>
<?php
}
else
{
?>
<p>your licence is in date</p>
<?php
}
有什么想法吗?我知道我在贬值的MYSQL中工作,但我需要为这个项目工作
干杯您需要转换为时间,日期只是一个字符串
$now = strtotime(date("Y-m-d"));
if (strtotime($user_id['enddate']) < $now) {
?>
<p>your Licence is out of date</p>
<?php
}
else
{
?>
<p>your licence is in date</p>
<?php
}
$now=strottime(日期(“Y-m-d”);
if(strotime($user_id['enddate'])<$now){
?>
你的执照过期了
你的执照有效期到了
供参考:解决方法如下:
$expirydate = mysql_query("SELECT enddate FROM users WHERE user_id = '".$_SESSION["user_id"]."'"); echo $query;
$expirydate2 = mysql_result($end, 0);
$now = strtotime(date("Y-m-d"));
if (strtotime($expirydate2) < $now) {
$expirydate=mysql\u query(“从用户中选择enddate,其中用户id=”。$\u会话[“用户id”]。””);echo$query;
$expireydate2=mysql\u结果($end,0);
$now=标准时间(日期(“Y-m-d”);
if(strotime($expireydate2)<$now){
希望这对你们中的一些人有所帮助。echo strotime(date(“Y-m-d”);
echo strotime($user_id['enddate']);
您得到了什么?看起来您需要将$user_id['enddate']设置为结束日期,如果没有问题,那么这就是问题所在。解决了!我让它与此一起工作:$end=mysql\query(“从用户id='”的用户中选择enddate“$\u会话[“用户id”]。””);echo$query;$end1=mysql\u结果($end,0);$now=strotime(日期)(“Y-m-d”);if(strotime($end1)<$now){
为Dave干杯!
$expirydate = mysql_query("SELECT enddate FROM users WHERE user_id = '".$_SESSION["user_id"]."'"); echo $query;
$expirydate2 = mysql_result($end, 0);
$now = strtotime(date("Y-m-d"));
if (strtotime($expirydate2) < $now) {