close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

MySQLi insert record not showing date form field in dynamic column bindings

Thread began 8/06/2014 11:58 am by Jason | Last modified 8/06/2014 12:15 pm by Jason | 1202 views | 3 replies

Jason

MySQLi insert record not showing date form field in dynamic column bindings

I'm trying to add an insert record form to a page on my website. All of the fields in my form show up in the dynamic data bindings except for the date field (see attached screenshot).

<?php require_once('Connections/local.php'); ?>
<?php require_once('Connections/local_i.php'); ?>
<?php require_once("webassist/database_management/wa_appbuilder_php.php"); ?>
<?php require_once('webassist/mysqli/queryobj.php'); ?>
<?php require_once('webassist/mysqli/rsobj.php'); ?>
<?php
$room = new WA_MySQLi_RS("room",$local_i,0);
$room->setQuery("SELECT kids_program_room.* FROM kids_program_room");
$room->execute();
?>
<?php
$position = new WA_MySQLi_RS("position",$local_i,0);
$position->setQuery("SELECT kids_program_position.* FROM kids_program_position");
$position->execute();
?>
<?php
$time = new WA_MySQLi_RS("time",$local_i,0);
$time->setQuery("SELECT kids_program_time.* FROM kids_program_time");
$time->execute();?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
?>
<?php
if ((((isset($_POST["submit"]))?$_POST["submit"]:"") != "")) {
$InsertQuery = new WA_MySQLi_Query($local_i);
$InsertQuery->Action = "insert";
$InsertQuery->Table = "kids_program_shifts";
$InsertQuery->bindColumn("kids_program_team_id", "i", "2", "WA_DEFAULT");
$InsertQuery->bindColumn("kids_program_room", "s", "".((isset($_POST["room"]))?$_POST["room"]:"") ."", "WA_DEFAULT");
$InsertQuery->bindColumn("kids_program_time", "s", "".((isset($_POST["time"]))?$_POST["time"]:"") ."", "WA_DEFAULT");
$InsertQuery->bindColumn("kids_program_volunteer", "i", "".$row_WADApcms2_users['UserID'] ."", "WA_DEFAULT");
$InsertQuery->bindColumn("kids_program_position", "s", "".((isset($_POST["position"]))?$_POST["position"]:"") ."", "WA_DEFAULT");
$InsertQuery->bindColumn("recurring", "c", "".((isset($_POST["recurring"]))?$_POST["recurring"]:"") ."", "WA_DEFAULT");
$InsertQuery->saveInSession("");
$InsertQuery->execute();
$InsertGoTo = "";
if (function_exists("rel2abs")) $InsertGoTo = $InsertGoTo?rel2abs($InsertGoTo,dirname(__FILE__)):"";
$InsertQuery->redirect($InsertGoTo);
}
?>
<?php
$ParamUserID_WADApcms2_users = "-1";
if (isset($_GET['UserID'])) {
$ParamUserID_WADApcms2_users = $_GET['UserID'];
}
mysql_select_db($database_local, $local);
$query_WADApcms2_users = sprintf("SELECT UserID, UserEmail, UserFirstName, UserLastName, UserCity, UserState, UserZip, UserPhone, UserCountry, UserGender, UserAddress, UserAddress2, UserDOB, SmallGroup FROM pcms2_users WHERE UserID = %s", GetSQLValueString($ParamUserID_WADApcms2_users, "int"));
$WADApcms2_users = mysql_query($query_WADApcms2_users, $local) or die(mysql_error());
$row_WADApcms2_users = mysql_fetch_assoc($WADApcms2_users);
$totalRows_WADApcms2_users = mysql_num_rows($WADApcms2_users);?>
<?php
$KidsProgramShifts = new WA_MySQLi_RS("KidsProgramShifts",$local_i,1);
$KidsProgramShifts->setQuery("SELECT kids_program_shifts.date, kids_program_shifts.recurring FROM kids_program_shifts");
$KidsProgramShifts->execute();
?>
<?php
// WA Application Builder Delete
if (isset($_POST["Delete"]) || isset($_POST["Delete_x"])) // Trigger
{
$WA_connection = $local;
$WA_table = "pcms2_users";
$WA_redirectURL = "pcms2_users_results.php?UserID=".((isset($_POST["WADADeleteRecordID"]))?$_POST["WADADeleteRecordID"]:"") ."";
if (function_exists("rel2abs")) $WA_redirectURL = $WA_redirectURL?rel2abs($WA_redirectURL,dirname(__FILE__)):"";
$WA_keepQueryString = false;
$WA_fieldNamesStr = "UserID";
$WA_columnTypesStr = "',none,''";
$WA_fieldValuesStr = "".((isset($_POST["WADADeleteRecordID"]))?$_POST["WADADeleteRecordID"]:"") ."";
$WA_comparisonStr = "=";
$WA_fieldNames = explode("|", $WA_fieldNamesStr);
$WA_fieldValues = explode($WA_AB_Split, $WA_fieldValuesStr);
$WA_columns = explode("|", $WA_columnTypesStr);
$WA_comparisions = explode("|", $WA_comparisonStr);
$WA_connectionDB = $database_local;
mysql_select_db($WA_connectionDB, $WA_connection);
if (!session_id()) session_start();
$deleteParamsObj = WA_AB_generateWhereClause($WA_fieldNames, $WA_columns, $WA_fieldValues, $WA_comparisions);
$WA_Sql = "DELETE FROM `" . $WA_table . "` WHERE " . $deleteParamsObj->sqlWhereClause;
$MM_editCmd = mysql_query($WA_Sql, $WA_connection) or die(mysql_error());
if ($WA_redirectURL != "") {
if ($WA_keepQueryString && $WA_redirectURL != "" && isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] !== "" && sizeof($_POST) > 0) {
$WA_redirectURL .= ((strpos($WA_redirectURL, '?') === false)?"?":"&").$_SERVER["QUERY_STRING"];
}
header("Location: ".$WA_redirectURL);
}
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled Document</title>
<script src="webassist/progress_bar/jquery-blockui-formprocessing.js" type="text/javascript"></script>

<link href="webassist/forms/fd_basic_default.css" rel="stylesheet" type="text/css">
<link href="webassist/forms/dataassist_button.css" rel="stylesheet" type="text/css" />
<style>

/* Details page CSS */
form.DetailsPage {
width: auto;
}

.black_overlay{
display: none;
position: absolute;
top: 0%;
left: 0%;
width: 100%;
height: 100%;
background-color: black;
z-index:1001;
-moz-opacity: 0.8;
opacity:.80;
filter: alpha(opacity=80);
}
.messageContainer {
display: none;
position: absolute;
top:0;
width: 100%;
z-index:1002;
text-align:center;
height:100%;
#position: relative;
overflow: hidden;
}
.messageWrapper {
#position: absolute;
#top: 50%;
display: table-cell;
vertical-align: middle;
}
.messageContent {
background-color:white;
display: inline-block;
padding: 16px;
border: 16px solid grey;
z-index:1002;
overflow: auto;
margin: auto;
#position: relative;
#top: -50%;
}</style>
</head>

<body>
<div id="Details_Basic_Default_ProgressWrapper">
<form class="DetailsPage Basic_Default" id="Details_Basic_Default" name="Details_Basic_Default" method="post" action="<?php echo (htmlentities($_SERVER["PHP_SELF"], ENT_QUOTES)); ?>">
<fieldset class="Basic_Default" id="Details">
<legend class="groupHeader">Details</legend>

<div>
<a name="top"></a>
<?php if ($totalRows_WADApcms2_users > 0) { // Show if recordset not empty ?>
<div id="WADADetails">
<table class="WADADataTable" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td class="DetailsSublabel">User ID:</td>
<td class="DetailsPage"><?php echo($row_WADApcms2_users['UserID']); ?></td>
</tr>
<tr>
<td class="DetailsSublabel">Email:</td>
<td class="DetailsPage"><?php echo($row_WADApcms2_users['UserEmail']); ?></td>
</tr>
<tr>
<td class="DetailsSublabel">First Name:</td>
<td class="DetailsPage"><?php echo($row_WADApcms2_users['UserFirstName']); ?></td>
</tr>
<tr>
<td class="DetailsSublabel">Last Name:</td>
<td class="DetailsPage"><?php echo($row_WADApcms2_users['UserLastName']); ?></td>
</tr>
<tr>
<td class="DetailsSublabel">City:</td>
<td class="DetailsPage"><?php echo($row_WADApcms2_users['UserCity']); ?></td>
</tr>
<tr>
<td class="DetailsSublabel">State:</td>
<td class="DetailsPage"><?php echo($row_WADApcms2_users['UserState']); ?></td>
</tr>
<tr>
<td class="DetailsSublabel">Zip Code:</td>
<td class="DetailsPage"><?php echo($row_WADApcms2_users['UserZip']); ?></td>
</tr>
<tr>
<td class="DetailsSublabel">Phone:</td>
<td class="DetailsPage"><?php echo($row_WADApcms2_users['UserPhone']); ?></td>
</tr>
<tr>
<td class="DetailsSublabel">Country:</td>
<td class="DetailsPage"><?php echo($row_WADApcms2_users['UserCountry']); ?></td>
</tr>
<tr>
<td class="DetailsSublabel">Gender:</td>
<td class="DetailsPage"><?php echo($row_WADApcms2_users['UserGender']); ?></td>
</tr>
<tr>
<td class="DetailsSublabel">Address:</td>
<td class="DetailsPage"><?php echo($row_WADApcms2_users['UserAddress']); ?></td>
</tr>
<tr>
<td class="DetailsSublabel">Address2:</td>
<td class="DetailsPage"><?php echo($row_WADApcms2_users['UserAddress2']); ?></td>
</tr>
<tr>
<td class="DetailsSublabel">Date of Birth:</td>
<td class="DetailsPage"><?php echo(($row_WADApcms2_users['UserDOB'])?date('n/d/Y',strtotime($row_WADApcms2_users['UserDOB'])):''); ?></td>
</tr>
<tr>
<td class="DetailsSublabel">Small Group:</td>
<td class="DetailsPage"><?php echo($row_WADApcms2_users['SmallGroup']); ?></td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
</tr>
</table>
<hr/>
</div>
<?php } // Show if recordset not empty ?>
<?php if ($totalRows_WADApcms2_users == 0) { // Show if recordset empty ?>
<div>
<div>This record has been removed.</div>
</div>
<hr/>
<?php } // Show if recordset empty ?>
</div>
<span class="buttonFieldGroup" >
<div>
<input type="button" value="Update" class="formButton unstyled" id="Update" name="Update" onClick="document.location.href = 'pcms2_users_update.php?UserID=<?php echo($row_WADApcms2_users["UserID"]); ?>
<?php echo(isset($_GET["pageNum_WADApcms2_users"])?"&pageNum_WADApcms2_users=".intval($_GET["pageNum_WADApcms2_users"]):""); ?>';" />
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<?php if ($totalRows_WADApcms2_users > 0) { // Show if recordset not empty ?>
<td><input type="button" value="Top" class="formButton unstyled" id="Top" name="Top" onclick="window.location.hash='top';" /></td>
<td>&nbsp;</td>
<td><input type="button" value="Delete" class="formButton unstyled" id="DeleteConfirm" name="DeleteConfirm" onclick="document.getElementById('deleteBox').style.display = 'block';document.getElementById('deleteMessage').style.display = 'table';" /></td>
<?php } // Show if recordset not empty ?>



<td><input type="button" value="Back To Results" class="formButton unstyled" id="BackToResults" name="BackToResults" onclick="document.location.href = 'pcms2_users_results.php<?php echo(isset($_GET["pageNum_WADApcms2_users"])?"?pageNum_WADApcms2_users=".intval($_GET["pageNum_WADApcms2_users"]):""); ?>';" /></td>
</tr>
</table>
</div></span>
</fieldset>
</form></div><div id="Details_Basic_Default_ProgressMessageWrapper" class="blockUIOverlay" style="display:none;">
<script type="text/javascript">
WADFP_SetProgressToForm('Details_Basic_Default', 'Details_Basic_Default_ProgressMessageWrapper', WADFP_Theme_Options['BigSpin:Slate']);
</script>
<div id="Details_Basic_Default_ProgressMessage" >
<p style="margin:10px; padding:5px;" ><img src="webassist/progress_bar/images/slate-largespin.gif" alt="" title="" style="vertical-align:middle;" />&nbsp;&nbsp;Please wait</p>
</div>
</div>


<div class="black_overlay" id="deleteBox"></div>
<div class="messageContainer" id="deleteMessage">
<div class="messageWrapper">
<form class="Basic_Default" method="post" action="<?php echo (htmlentities($_SERVER["PHP_SELF"], ENT_QUOTES)); ?>" style="width:auto;">
<input type="hidden" name="WADADeleteRecordID" id="WADADeleteRecordID" value="<?php echo($row_WADApcms2_users["UserID"]); ?>" />
<div class="messageContent">
This will permanently remove the record from your database.<br/>
This action cannot be undone.<br/><br/>
<input type="submit" value="Delete" class="formButton unstyled" id="Delete" name="Delete" />
<input type="button" value="Cancel" class="formButton unstyled" id="Cancel" name="Cancel" onclick="document.getElementById('deleteBox').style.display = 'none';document.getElementById('deleteMessage').style.display = 'none';" />
</div>
</form>
</div>
</div>
<form>
<select name="room" id="room">
<?php
while(!$room->atEnd()) { //dyn select
?>
<option value="<?php echo($room->getColumnVal("id")); ?>"><?php echo($room->getColumnVal("room")); ?></option>
<?php
$room->moveNext();
} //dyn select
$room->moveFirst();
?>
</select>
<select name="time" id="time">
<?php
while(!$time->atEnd()) { //dyn select
?>
<option value="<?php echo($time->getColumnVal("id")); ?>"><?php echo($time->getColumnVal("time")); ?></option>
<?php
$time->moveNext();
} //dyn select
$time->moveFirst();
?>

</select>
</select>
<input type="hidden" value="<?php echo $row_WADApcms2_users['UserID']; ?>">
<select name="position" id="position">
<?php
while(!$position->atEnd()) { //dyn select
?>
<option value="<?php echo($position->getColumnVal("id")); ?>"><?php echo($position->getColumnVal("position")); ?></option>
<?php
$position->moveNext();
} //dyn select
$position->moveFirst();
?>
</select>
<input type="date" name="date">
<input type="checkbox" name="recurring">
<input type="submit" name="submit">

</form>
</body>
</html>
<?php
mysql_free_result($WADApcms2_users);
?>

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...