Jump to content

variable to hold NOW() funtion


nepeaNMedia

Recommended Posts

Hi Folks

 

What I want to do is add a date to a table via user input form. If the user does NOT enter a date the variable needs to hold the value of  mysql NOW().

 

I have this code;

 

if(strlen($_POST['expiryDate'])>3){

$expDat = $_POST['expiryDate'];

}else{

$expDat = 'NOW()';

}

 

However, when I write $expDat into the query it doe not generate the NOW() value that typing NOW() directly into the query would produce

 

any ideas

 

cheers in anticipation

 

paul

Link to comment
https://forums.phpfreaks.com/topic/95435-variable-to-hold-now-funtion/
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.