# \[MySQL/PHP\] cookies not working

**URL:** <https://forum.kirupa.com/t/mysql-php-cookies-not-working/190563>\
**Category:** programming\
**Created:** [June 13, 2006, 12:14am UTC](https://forum.kirupa.com/t/mysql-php-cookies-not-working/190563 "2006-06-13T00:14:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![NeoDreamer](https://avatars.discourse-cdn.com/v4/letter/n/ccd318/32.png) [@NeoDreamer](https://forum.kirupa.com/u/NeoDreamer)\
**Post date:** [June 13, 2006, 12:14am UTC](https://forum.kirupa.com/t/mysql-php-cookies-not-working/190563/1 "2006-06-13T00:14:04Z")

</div>

This is part of my code for a log in page. The setcookie function is not making any cookies though. How do I know? I tried echoing it and nothing was printed to the screen. I have already made sure that $ID is being set properly.

```php

echo("<h2>Log In</h2>");
if($num != 0)
{
	// message
	echo("Log in is successful.");
	
	// log in
	if($rememberMe == "checked")
	{
		$expTime = 2592000;
	}
	else 
	{
		$expTime = 864000;
	}
	$row = mysql_fetch_array($rs);
	$ID = $row["ID"];
	setcookie("ID", $ID, time()+$expTime);
}

```
