troubleshooting Question

Add date format to database PHP + MySQL

Avatar of BrighteyesDesign
BrighteyesDesignFlag for Afghanistan asked on
PHPMySQL Server
9 Comments2 Solutions419 ViewsLast Modified:
I am trying to add a date to my database but can't get it working!

There are three dropdowns selecting the MM-DD-YYYY. I'm then trying to join them together and send them tothe database. Any ideas what's wrong here?

 form database
$bd = mysqli_real_escape_string($dbc, $trimmed['bdayday']);
$bm = mysqli_real_escape_string($dbc, $trimmed['bdaymonth']);
$by = mysqli_real_escape_string($dbc, $trimmed['bdayyear']);
$birthday = $by."//".$bm."//".$bd;

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
  $insertSQL = sprintf("INSERT INTO board (title, copy, `date`) VALUES (%s, %s, %s)",
                       GetSQLValueString($_POST['title'], "text"),
                       GetSQLValueString($_POST['copy'], "text"),
                       GetSQLValueString($_POST['$birthday'], "date"));

  mysql_select_db($database_anjoman, $anjoman);
  $Result1 = mysql_query($insertSQL, $anjoman) or die(mysql_error());

  $insertGoTo = "AdminUpdated.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $insertGoTo));
}

mysql_select_db($database_anjoman, $anjoman);
$query_Recordset1 = "SELECT id, title, copy, `date` FROM board";
$Recordset1 = mysql_query($query_Recordset1, $anjoman) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
ASKER CERTIFIED SOLUTION
wmadrid1

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 2 Answers and 9 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 9 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros