Re: converting a char variable to an int?

From: Date: Mon, 14 Jun 2004 15:36:19 +0000
Subject: Re: converting a char variable to an int?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-188226@lists.php.net to get a copy of this message
"Adam Williams" <awilliam@mdah.state.ms.us> wrote in message news:Pine.LNX.4.44.0406141029240.26039-100000@roark.mdah.state.ms.us... > Hi, I have a variable that is created using the date command: > > $date = date("Ymd"); > > but its not working in my database this way (when I explicity enter > 20040614 in my database, it works though). so I think PHP is making $date > a character variable, so how can I force or change the caste of $date to > force it to be an integer variable? thanks Try this: $date = (int) $date; See here: http://de2.php.net/language.types.type-juggling But it should also work as a PHP string with your DB. Could you post your INSERT/UPDATE statement? Regards, Torsten Roehr

« previous php.general (#188226) next »