Ir para conteúdo

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

Lucio10

Erro ao enviar dados para o banco de dados

Recommended Posts

Tenho esse problema ao enviar informações para o banco de dados, pois aparece essa informações:

 

Você tem um erro em sua sintaxe SQL; verifique o manual que corresponde à sua versão do servidor MariaDB para o direito de utilizar sintaxe próximo '? o, numero, Bairro, Cidade, CEP, estado) VALUES (' Lucio Andrade Silva ',' luciofe 'at line 1

 

A estrutura com banco esta assim:

 

<?php require_once('Connections/banco.php'); ?>
<?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"] == "form1")) {
$insertSQL = sprintf("INSERT INTO clientes (nome, email, senha, cpf, telefone, endereço, numero, bairro, cidade, cep, estado) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['nome'], "text"),
GetSQLValueString($_POST['email'], "text"),
GetSQLValueString($_POST['senha'], "text"),
GetSQLValueString($_POST['cpf'], "text"),
GetSQLValueString($_POST['telefone'], "text"),
GetSQLValueString($_POST['endereo'], "text"),
GetSQLValueString($_POST['numero'], "text"),
GetSQLValueString($_POST['bairro'], "text"),
GetSQLValueString($_POST['cidade'], "text"),
GetSQLValueString($_POST['cep'], "text"),
GetSQLValueString($_POST['estado'], "text"));
mysql_select_db($database_banco, $banco);
$Result1 = mysql_query($insertSQL, $banco) or die(mysql_error());
$insertGoTo = "login.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?>
Gostaria muito resolver esse problema, deste de já agradeço pela contribuição.

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.