Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Boa Tarde...
alguem pode me ajudar, nao estou conseguindo inserir data de nascimento no mysql nao estou conseguindo...
estou usando o dreamweaver, ja procurei de tudo... mas nao estou conseguindo incluir
gerado pelo Dreamweaver
<?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;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "cadastro")) {
$insertSQL = sprintf("INSERT INTO cadclientes (nomecompleto, sexo, dtnascimento, rg, orgaoexpedidor, cpf, unidadeatendimento, telprincipal, celular, telrecado, email, cep, estado, cidade, bairro, endereco) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['nome'], "text"),
GetSQLValueString($_POST['sexo'], "text"),
GetSQLValueString($_POST['data'], "date"),
GetSQLValueString($_POST['rg'], "int"),
GetSQLValueString($_POST['ssp'], "text"),
GetSQLValueString($_POST['cpf'], "text"),
GetSQLValueString($_POST['unidade'], "text"),
GetSQLValueString($_POST['tel'], "text"),
GetSQLValueString($_POST['tel1'], "text"),
GetSQLValueString($_POST['tel2'], "text"),
GetSQLValueString($_POST['email'], "text"),
GetSQLValueString($_POST['cep'], "text"),
GetSQLValueString($_POST['estado'], "text"),
GetSQLValueString($_POST['cidade'], "text"),
GetSQLValueString($_POST['bairro'], "text"),
GetSQLValueString($_POST['endereco'], "text"));
mysql_select_db($database_dbclientes, $dbclientes);
$Result1 = mysql_query($insertSQL, $dbclientes) or die(mysql_error());
E o form onde vai a data de nascimento.
<div class="form-group col-md-3">
<label for="nascimento">DATA DE NASCIMENTO:</label>
<input type="date" class="form-control input-sm" name="data" id="data" onKeyPress="MascaraData(cadastro.data);" maxlength="10" onBlur= "ValidaDatacadastro.data);" required>
</div>Carregando comentários...