Jump to content

[SOLVED] Date warning


jandrews3

Recommended Posts

I keep getting the following warning for the code below:

Warning: date() expects parameter 2 to be long, string given in /home/temp1/public_html/admin_cpanel.php on line 136

$yer = date('Y');
$query2 = "SELECT * FROM ithf_members";
$result2= mysql_query($query2) or die("Could not perform query: ".mysql_error());
while ($row2 = mysql_fetch_array($result2)){
	$pull = date("Y-m-d",$row2['entrydate']);
	if (substr($pull,0,7) == $yer."-01"){$jan++;}
	if (substr($pull,0,7) == $yer."-02"){$feb++;}
	if (substr($pull,0,7) == $yer."-03"){$mar++;}
	if (substr($pull,0,7) == $yer."-04"){$apr++;}
	if (substr($pull,0,7) == $yer."-05"){$may++;}
	if (substr($pull,0,7) == $yer."-06"){$jun++;}
	if (substr($pull,0,7) == $yer."-07"){$jul++;}
	if (substr($pull,0,7) == $yer."-08"){$aug++;}
	if (substr($pull,0,7) == $yer."-09"){$sep++;}
	if (substr($pull,0,7) == $yer."-10"){$oct++;}
	if (substr($pull,0,7) == $yer."-11"){$nov++;}
	if (substr($pull,0,7) == $yer."-12"){$dec++;}
}

 

 

Link to comment
https://forums.phpfreaks.com/topic/121319-solved-date-warning/
Share on other sites

Wow! Thanks! I hadn't noticed that. I thought something designated as varchar in a MySQL database could be treated flexibly as any other integer or string. I thought that's what the point was. I changed it from varchar to int and it worked. Thanks!

Link to comment
https://forums.phpfreaks.com/topic/121319-solved-date-warning/#findComment-625488
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.