Jump to content

strtotime()


xyn

Recommended Posts

Hey.

I'm having a small problem with my sql syntax. Basically

I wanted to check how many e-mails a member is

allowed to send out.  then using sql num rows to see how

many they have sent.

 

Well i used date("j/m/y, h:i:s", strtotime("today")); and i

don't think this is the correct method.

 

my code:

while(list($max_mail, $max_tmout) = mysql_fetch_array($sql_limit_perm))
{
$email_maximum = $max_mail;
$email_timeout = $max_tmout;
switch($email_maximum)
{
	case x:
			$ignore_mail_max = 1;
			break;
	default:
			$ignore_mail_max = 0;
			break;
}
}

if($ignore_mail_max != "1") 
{
$sql_senders_limit = mysql_query("SELECT `id` 
FROM `asc_emaillogs` 
WHERE `sentby`='".$_SESSION['userName']."' 
AND `senton`='".date("j/m/Y, H:i:s", strtotime("Today"))."'");

if(mysql_num_rows($sql_senders_limit) >=$email_maximum)
{
	$error[] = "You have reached your limit today.";
}
}

 

the ignroe is for mods, super-mods, admins and super-admins

thanks,

ash

Link to comment
Share on other sites

I would suspect this is just a simple issue to do with how you are storing the date the email was sent on. What field type are you using to store this? If you are using a datetime field, then you are going to need to select all of those dates and times which are between the beginning of the start of the current day, and the current time.

 

If you are using a date field, then you'll just need a simple match on the date. If either of these are the case, take a look at the way the dates are actually stored. They are stored as yyyy-mm-dd. You'll need to format your date in this way too.

 

Finally, if you are storing your date in a varchar field(bad idea) then you can use the mysql function UNIX_TIMESTAMP to compare with a php generated timestamp for the current day.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.