affordit Posted February 16, 2008 Share Posted February 16, 2008 Im trying to update a registration expiration date the code below is what im trying to use but Ithink I got the syntax wrong at the point where im changing the $end_date to $new_end_date can someone help please <?php include("sharons_dbinfo.inc.php"); mysql_connect(mysql,$name,$password); @mysql_select_db($database) or die( "Unable to select database"); // // CHANGE QUERY TO GRAB THE ID // $query = "select id, email, end_date, valid FROM login WHERE `email`= '$email'"; $result=mysql_query($query) or die (mysql_error()); if (mysql_num_rows($result)<1) { echo "You must enter your Email address."; exit(); } else { while ($info = mysql_fetch_array($result)) { $end_date = $info['end_date']; $new_end_date = $end_date("Y-m-d",strtotime("+ 5 days")); } echo "$new_end_date"; } ?> Quote Link to comment Share on other sites More sharing options...
toplay Posted February 16, 2008 Share Posted February 16, 2008 Change query to: $query = "select id, email, end_date, valid, DATE_ADD(end_date, INTERVAL 5 DAY) AS new_end_date FROM login WHERE `email`= '$email'"; Get column with: $new_end_date = $info['new_end_date']; http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_date-add http://us3.php.net/manual/en/function.date.php http://us3.php.net/manual/en/function.strtotime.php Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.