Jump to content


Photo

Meu Código Não Está Efetuando Cadastro?


  • Faça o login para participar
4 replies to this topic

#1 webmastermichael

webmastermichael

    Novato no fórum

  • Usuários
  • 17 posts
  • Sexo:Masculino
  • Localidade:São Paulo

Posted 27/10/2008, 14:21

meu código e esse aqui [codebox]<?php
mb_http_input("utf-8");
mb_http_output("utf-8");
?>
<?php require_once('Connections/data.php'); ?><?php require_once('Connections/data.php'); ?><?php
if (!isset($_SESSION)) {
session_start();
}
$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";

// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
// For security, start by assuming the visitor is NOT authorized.
$isValid = False;

// When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
// Therefore, we know that a user is NOT logged in if that Session variable is blank.
if (!empty($UserName)) {
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
// Parse the strings into arrays.
$arrUsers = Explode(",", $strUsers);
$arrGroups = Explode(",", $strGroups);
if (in_array($UserName, $arrUsers)) {
$isValid = true;
}
// Or, you may restrict access to only certain users based on their username.
if (in_array($UserGroup, $arrGroups)) {
$isValid = true;
}
if (($strUsers == "") && true) {
$isValid = true;
}
}
return $isValid;
}

$MM_restrictGoTo = "index.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {
$MM_qsChar = "?";
$MM_referrer = $_SERVER['PHP_SELF'];
if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0)
$MM_referrer .= "?" . $QUERY_STRING;
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
header("Location: ". $MM_restrictGoTo);
exit;
}
?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$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 add_conta_receber (campo_fim) VALUES (%s)",
GetSQLValueString($_POST['campo_fim'], "text"));
mysql_select_db($database_data, $data);
$Result1 = mysql_query($insertSQL, $data) or die(mysql_error());

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

if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$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;
}
}

$maxRows_DetailRS1 = 10;
$pageNum_DetailRS1 = 0;
if (isset($_GET['pageNum_DetailRS1'])) {
$pageNum_DetailRS1 = $_GET['pageNum_DetailRS1'];
}
$startRow_DetailRS1 = $pageNum_DetailRS1 * $maxRows_DetailRS1;

$colname_DetailRS1 = "-1";
if (isset($_GET['recordID'])) {
$colname_DetailRS1 = $_GET['recordID'];
}
mysql_select_db($database_data, $data);
$query_DetailRS1 = sprintf("SELECT * FROM anunciante WHERE codigo = %s", GetSQLValueString($colname_DetailRS1, "int"));
$query_limit_DetailRS1 = sprintf("%s LIMIT %d, %d", $query_DetailRS1, $startRow_DetailRS1, $maxRows_DetailRS1);
$DetailRS1 = mysql_query($query_limit_DetailRS1, $data) or die(mysql_error());
$row_DetailRS1 = mysql_fetch_assoc($DetailRS1);

if (isset($_GET['totalRows_DetailRS1'])) {
$totalRows_DetailRS1 = $_GET['totalRows_DetailRS1'];
} else {
$all_DetailRS1 = mysql_query($query_DetailRS1);
$totalRows_DetailRS1 = mysql_num_rows($all_DetailRS1);
}
$totalPages_DetailRS1 = ceil($totalRows_DetailRS1/$maxRows_DetailRS1)-1;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR...nsitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Lançamentos de contas a receber</title>
<script src="SpryAssets/SpryEffects.js" type="text/javascript"></script>
<script type=text/javascript>
function copia(nome,campo_fim) {
if(nome.checked)
{
campo_fim.value += nome.value + '\r\n';
}
else
{
campo_fim.value = campo_fim.value.toString().replace(nome.value,"");
campo_fim.value = campo_fim.value.toString().replace("\r\n","");
}
}
</script></script>
<link href="css/style.css" rel="stylesheet" type="text/css" />
</head>

<body>
<table width="84%" border="0" cellpadding="0" cellspacing=" 0">
<tr>
<td width="48"><div align="center"><img src="Imagens/1551_128x128.png" alt="" width="48" height="48" /></div></td>
<td width="640"><strong>ADICIONE OS PREDIOS </strong></td>
<td width="450"><b><b><b> <img src="Imagens/4435_128x128.png" width="48" height="48" /><a href="fechar.php" target="_self">Fechar Janela</a></b></b></b></td>
</tr>
<tr>
<td>&nbsp;</td>
<td colspan="2"><table border="0" cellspacing="3" cellpadding="0" class="verdana" width="1218" >
<form action="<?php echo $editFormAction; ?>" method="POST" name="form1" id="form1">

<tr align="right">
<td width="233" height="5"><div align="center">Usuário que está cadastrando:<br />
<input name="Funcionario" type="text" id="Funcionario" value="<?php echo $_SESSION['MM_Username']; ?>" />

</div>
<div align="left"></div></td>
<td width="234"><div align="center">Anunciante:</b><br />
<input name="Cliente" type="text" id="Cliente" value="<?php echo $row_DetailRS1['Cliente']; ?>" onkeyup="muda(this)"/>
&nbsp;</div></td>
<td width="736" height="6">
<div align="left"><?php
//Conectando com o banco de dados MysQL e selecionando a base de dados.
$con=mysql_connect('xxxxxxxxx','xxxxxxx','xxxxxxxxxxxx')or die('Erro na conexção, verifique os dados'.mysql_error($con));
mysql_select_db('ubccriative1',$con)or die('Erro ao selecionar a tabela'.mysql_error($con));
//Varrendo a tabela dados, para pegar todos os dados.
$selecao=mysql_query("SELECT codigo,nome FROM cliente")or die('Erro na consulta SQL'.mysql_error($con));

if (mysql_num_rows($selecao) != 0)
{
echo "<form name='nome'>";

while($ver = mysql_fetch_array($selecao))
{
echo "$ver[1]<input type=\"checkbox\" value=\"$ver[1]\" onClick=\"copia(this,campo_fim);\">";
}

echo "<textarea name='campo_fim' rows='3' cols='20'></textarea></form>";




//Libramos a memória ocupada pela consulta com o free_result.
mysql_free_result($selecao);
//Fechamos a conexão com a base de dados após as operações.
mysql_close($con);
}
?>
</div></td>
</tr>
<tr align="right">
<td width="470" height="18" colspan="2">&nbsp;</td>
<td height="18">&nbsp;</td>
</tr>
<tr align="right">
<td height="3" colspan="2"><input type="submit" name="button" id="button" value=" Efetuar Cadastror") />
<input type="reset" name="button2" id="button2" value="Limpar Cadastro" /></td>
<td height="3"><?
setlocale(LC_TIME,"portuguese");
echo strftime("Hoje é %A, %d de %B de %Y");
?></td>
</tr>

<input type="hidden" name="MM_insert" value="form1" />
</form>
</table></td>
</tr>
</table>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<table width="1362" border="0">
<tr>
<td><div align="center">
</body>
</html>
<?php
mysql_free_result($DetailRS1);
?>

[/codebox]


e o seguinte depois que adc esse código aqui
[codebox]<?php
//Conectando com o banco de dados MysQL e selecionando a base de dados.
$con=mysql_connect('xxxxxxxxxx','xxxxxxxxx','cxxxxxxxxxx')or die('Erro na conexção, verifique os dados'.mysql_error($con));
mysql_select_db('ubccriative1',$con)or die('Erro ao selecionar a tabela'.mysql_error($con));
//Varrendo a tabela dados, para pegar todos os dados.
$selecao=mysql_query("SELECT codigo,nome FROM cliente")or die('Erro na consulta SQL'.mysql_error($con));

if (mysql_num_rows($selecao) != 0)
{
echo "<form name='nome'>";

while($ver = mysql_fetch_array($selecao))
{
echo "$ver[1]<input type=\"checkbox\" value=\"$ver[1]\" onClick=\"copia(this,campo_fim);\">";
}

echo "<textarea name='campo_fim' rows='3' cols='20'></textarea></form>";




//Libramos a memória ocupada pela consulta com o free_result.
mysql_free_result($selecao);
//Fechamos a conexão com a base de dados após as operações.
mysql_close($con);
}
?>[/codebox]


juntamente com esse
[codebox]<script type=text/javascript>
function copia(nome,campo_fim) {
if(nome.checked)
{
campo_fim.value += nome.value + '\r\n';
}
else
{
campo_fim.value = campo_fim.value.toString().replace(nome.value,"");
campo_fim.value = campo_fim.value.toString().replace("\r\n","");
}
}
</script>[/codebox]


o meu botão não efetua o cadastro o código do botão e esse
[codebox]<input type="submit" name="button" id="button" value=" Efetuar Cadastror") />
<input type="reset" name="button2" id="button2" value="Limpar Cadastro" />[/codebox]


alguém sabe o que está acontecendo por favor????? :assobio: :assobio: :assobio: :assobio: :assobio: :assobio:

#2 silici0

silici0

    ?

  • Usuários
  • 902 posts
  • Sexo:Masculino
  • Localidade:São Paulo - SP
  • Interesses:PHP, MySQL, XHTML, CSS, AJAX, JavaScript, Objective-C, Python, Games ... #geek

Posted 27/10/2008, 14:50

Usar var_dump print_r e echo para debugar !!!

Não por nada mas ninguem tem muita paciencia para ficar lendo o codigo e debugando de cabeça para achar um problema... O_o

Abraços
Procurando freelancer
***********************************************
Bachelor of Technology in Technology of Information, with great knowledge in Windows operating systems and Unix-Like (BSD, Ubuntu and Slackware), languages (PHP, JavaScript and MySQL), semantic (DHTML, Tableless, Ajax, MVC, OO) and analysis (manages projects based on PMI).
Developer in PHP, JAVA, Python, Objective-c MySQL, DHTML, CSS, JAVASCRIPT, JQUERY, JSON, SMARTY, MDB2, DOCTRINE, CAKEPHP. Linux desktop for work and MacOS. E-commerces, CRM and bussiness strategys
Love-me and be FREE use UniCes-Like .

#3 webmastermichael

webmastermichael

    Novato no fórum

  • Usuários
  • 17 posts
  • Sexo:Masculino
  • Localidade:São Paulo

Posted 27/10/2008, 15:09

A velho foi mau e que programo a pouco tempo no php rsrsrsr onde eu uso o código que vc me passo no meu botão desculpa a ignorância :lol: :lol: :lol: :lol: :lol: vlwww

deixei um link aqui para vc ver como esta !!!


https://ssl790.websi.../system/ver.php

#4 silici0

silici0

    ?

  • Usuários
  • 902 posts
  • Sexo:Masculino
  • Localidade:São Paulo - SP
  • Interesses:PHP, MySQL, XHTML, CSS, AJAX, JavaScript, Objective-C, Python, Games ... #geek

Posted 27/10/2008, 15:10

Procura no manual sobre as funções e usa a criatividade, 2 exemplos...

Quero saber os valores vindo da global POST então no começo eu print_r($_POST);

Quero saber se esta entrando dentro da condição do IF e o valor da variavel $teste do if;

var_dump($teste);
if(isset($teste)){
  echo '??????????? ENTROU AE q alegria enorme !!!!! ';
}

Entendeu ?

Abraços
Procurando freelancer
***********************************************
Bachelor of Technology in Technology of Information, with great knowledge in Windows operating systems and Unix-Like (BSD, Ubuntu and Slackware), languages (PHP, JavaScript and MySQL), semantic (DHTML, Tableless, Ajax, MVC, OO) and analysis (manages projects based on PMI).
Developer in PHP, JAVA, Python, Objective-c MySQL, DHTML, CSS, JAVASCRIPT, JQUERY, JSON, SMARTY, MDB2, DOCTRINE, CAKEPHP. Linux desktop for work and MacOS. E-commerces, CRM and bussiness strategys
Love-me and be FREE use UniCes-Like .

#5 webmastermichael

webmastermichael

    Novato no fórum

  • Usuários
  • 17 posts
  • Sexo:Masculino
  • Localidade:São Paulo

Posted 29/10/2008, 15:58

sem chance ja tentei não estou tendo sucesso so dúvidas ?????????????? :wacko: :wacko: :wacko: :wacko:

[codebox]<?php
mb_http_input("utf-8");
mb_http_output("utf-8");
?>
<?php require_once('Connections/data.php'); ?><?php require_once('Connections/data.php'); ?><?php
if (!isset($_SESSION)) {
session_start();
}
$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";

// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
// For security, start by assuming the visitor is NOT authorized.
$isValid = False;

// When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
// Therefore, we know that a user is NOT logged in if that Session variable is blank.
if (!empty($UserName)) {
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
// Parse the strings into arrays.
$arrUsers = Explode(",", $strUsers);
$arrGroups = Explode(",", $strGroups);
if (in_array($UserName, $arrUsers)) {
$isValid = true;
}
// Or, you may restrict access to only certain users based on their username.
if (in_array($UserGroup, $arrGroups)) {
$isValid = true;
}
if (($strUsers == "") && true) {
$isValid = true;
}
}
return $isValid;
}

$MM_restrictGoTo = "index.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {
$MM_qsChar = "?";
$MM_referrer = $_SERVER['PHP_SELF'];
if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0)
$MM_referrer .= "?" . $QUERY_STRING;
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
header("Location: ". $MM_restrictGoTo);
exit;
}
?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$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 add_conta_receber (campo_fim) VALUES (%s)",
GetSQLValueString($_POST['campo_fim'], "text"));
mysql_select_db($database_data, $data);
$Result1 = mysql_query($insertSQL, $data) or die(mysql_error());

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

if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$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;
}
}

$maxRows_DetailRS1 = 10;
$pageNum_DetailRS1 = 0;
if (isset($_GET['pageNum_DetailRS1'])) {
$pageNum_DetailRS1 = $_GET['pageNum_DetailRS1'];
}
$startRow_DetailRS1 = $pageNum_DetailRS1 * $maxRows_DetailRS1;

$colname_DetailRS1 = "-1";
if (isset($_GET['recordID'])) {
$colname_DetailRS1 = $_GET['recordID'];
}
mysql_select_db($database_data, $data);
$query_DetailRS1 = sprintf("SELECT * FROM add_conta_receber WHERE Cod_Equipamento = %s", GetSQLValueString($colname_DetailRS1, "int"));
$query_limit_DetailRS1 = sprintf("%s LIMIT %d, %d", $query_DetailRS1, $startRow_DetailRS1, $maxRows_DetailRS1);
$DetailRS1 = mysql_query($query_limit_DetailRS1, $data) or die(mysql_error());
$row_DetailRS1 = mysql_fetch_assoc($DetailRS1);

if (isset($_GET['totalRows_DetailRS1'])) {
$totalRows_DetailRS1 = $_GET['totalRows_DetailRS1'];
} else {
$all_DetailRS1 = mysql_query($query_DetailRS1);
$totalRows_DetailRS1 = mysql_num_rows($all_DetailRS1);
}
$totalPages_DetailRS1 = ceil($totalRows_DetailRS1/$maxRows_DetailRS1)-1;
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR...nsitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
&lt;script src="SpryAssets/SpryEffects.js" type="text/javascript"></script>
</head>

<body>

&lt;script type=text/javascript>
function copia(nome,campo_fim) {
if(nome.checked)
{
campo_fim.value += nome.value + '\r\n';
}
else
{
campo_fim.value = campo_fim.value.toString().replace(nome.value,"");
campo_fim.value = campo_fim.value.toString().replace("\r\n","");
}
}
</script>

<?php
//Conectando com o banco de dados MysQL e selecionando a base de dados.
$con=mysql_connect('xxxxxxxxxxx','xxxxxxxxxx','xxxxxxxxxxx')or die('Erro na conexção, verifique os dados'.mysql_error($con));
mysql_select_db('ubccriative1',$con)or die('Erro ao selecionar a tabela'.mysql_error($con));
//Varrendo a tabela dados, para pegar todos os dados.
$selecao=mysql_query("SELECT codigo,nome FROM cliente")or die('Erro na consulta SQL'.mysql_error($con));

if (mysql_num_rows($selecao) != 0)
{
echo "<form name=\"nome\" method=\"POST\">";

while($ver = mysql_fetch_array($selecao)){
echo "$ver[1]<input type=\"checkbox\" name=\"excluir[]\" value=\"$ver[1]\" onClick=\"copia(this,campo_fim);\">";
}

echo "<textarea name='campo_fim' rows='3' cols='20'></textarea></form>";


echo "<input type=\"submit\" name=\"ok\" value=\"Adicionar\" /></form>";
//Libramos a memória ocupada pela consulta com o free_result.
mysql_free_result($selecao);
//Fechamos a conexão com a base de dados após as operações.
mysql_close($con);
}
?>
</body>
</html>
<?php
mysql_free_result($DetailRS1);
?>[/codebox]


meu código ta assim agora com POST mas nao esta indo

eu fiz um código novo como eu faço para esse código fazer um insert ??


[codebox]<?php
//Conectando com o banco de dados MysQL e selecionando a base de dados.
$con=mysql_connect('xxxxxxx','uxxxxxxxxx','xxxxxxxxxxxx')or die('Erro na conexção, verifique os dados'.mysql_error($con));
mysql_select_db('ubccriative1',$con)or die('Erro ao selecionar a tabela'.mysql_error($con));

//Verificamos se o método enviado pelo formulário é realmente o POST.
if($_SERVER['REQUEST_METHOD']=='POST'){
//Se sim, pegamos os dados em forma de vetor (array) e passamos para a variável $apagar.
$apagar=$_POST['excluir'];
/*Dou um loop para pegar os arrays e comparar com o valor de $i
Aqui que está o segredo da coisam se a variável $i que inicia em 0 for menor que os dados contidos
no array $apagar, ele vai incrementar até chegar ao valor, repetindo dentro do laço a função para deletar
a quantidade correta de dados selecionados...
*/
for($i=0; $i<count($apagar); $i++){
$sql=mysql_query("INSERT INTO pre_predio WHERE codigo='$apagar[$i]' VALUES ($s)")or die('Erro ao apagar os dados'.mysql_error($con));
}
/* verificamos com um IF simplificado se os dados foram excluídos. */
($sql) ? (print('Dados excluídos com êxito !')) : die('Erro ao excluir os dados.');
}
?>

<?
echo "<meta HTTP-EQUIV='Refresh' CONTENT='0;URL=submenu2.php'>";
?>[/codebox]


por que quando mando ele fazer insert ele da um erro assim WHERE codigo='4'' at line 1


e os meus insert eu usso isso para fazer

[codebox]"INSERT INTO add_conta_receber (Funcionario, Cliente, descricao, pago, pago1, pago2, pago3, pago4, pago5, pago6, pago7, pago8, pago9, pago10, predio, valor_d, valor_e, valor_f, valor_g, valor_h, valor_i, valor_j, valor_telefone, valor_l, valor_m, parcela_n, parcela_o, parcela_p, valor_a, parcela_q, parcela_r, parcela_m, parcela_s, parcela_l, parcela_t, parcela_u, parcela_cnpj, parcela_banco, valor_b, valor_c, insc_estadual, data_contrato, custo_criacao, valor, lancamento, documento, Hora_Entrada) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['Funcionario'], "text"),
GetSQLValueString($_POST['Cliente'], "text"),
GetSQLValueString($_POST['descricao'], "text"),
GetSQLValueString($_POST['predio'], "text"),
GetSQLValueString($_POST['pago'], "text"),
GetSQLValueString($_POST['pago1'], "text"),
GetSQLValueString($_POST['pago2'], "text"),
GetSQLValueString($_POST['pago3'], "text"),
GetSQLValueString($_POST['pago4'], "text"),
GetSQLValueString($_POST['pago5'], "text"),
GetSQLValueString($_POST['pago6'], "text"),
GetSQLValueString($_POST['pago7'], "text"),
GetSQLValueString($_POST['pago8'], "text"),
GetSQLValueString($_POST['pago9'], "text"),
GetSQLValueString($_POST['pago10'], "text"),
GetSQLValueString($_POST['valor_d'], "text"),
GetSQLValueString($_POST['valor_a'], "text"),
GetSQLValueString($_POST['valor_e'], "text"),
GetSQLValueString($_POST['valor_f'], "text"),
GetSQLValueString($_POST['valor_g'], "text"),
GetSQLValueString($_POST['valor_h'], "text"),
GetSQLValueString($_POST['valor_i'], "text"),
GetSQLValueString($_POST['valor_j'], "text"),
GetSQLValueString($_POST['valor_telefone'], "text"),
GetSQLValueString($_POST['valor_l'], "text"),
GetSQLValueString($_POST['valor_m'], "text"),
GetSQLValueString($_POST['parcela_n'], "text"),
GetSQLValueString($_POST['parcela_m'], "text"),
GetSQLValueString($_POST['parcela_o'], "text"),
GetSQLValueString($_POST['parcela_p'], "text"),
GetSQLValueString($_POST['parcela_l'], "text"),
GetSQLValueString($_POST['parcela_q'], "text"),
GetSQLValueString($_POST['parcela_r'], "text"),
GetSQLValueString($_POST['parcela_s'], "text"),
GetSQLValueString($_POST['parcela_t'], "text"),
GetSQLValueString($_POST['parcela_u'], "text"),
GetSQLValueString($_POST['parcela_cnpj'], "text"),
GetSQLValueString($_POST['parcela_banco'], "text"),
GetSQLValueString($_POST['valor_b'], "text"),
GetSQLValueString($_POST['valor_c'], "text"),
GetSQLValueString($_POST['insc_estadual'], "text"),
GetSQLValueString($_POST['data_contrato'], "text"),
GetSQLValueString($_POST['custo_criacao'], "text"),
GetSQLValueString($_POST['valor'], "text"),
GetSQLValueString($_POST['lancamento'], "text"),
GetSQLValueString($_POST['documento'], "text"),
GetSQLValueString($_POST['Hora_Entrada'], "text"));[/codebox]

ae mudei meu código agora eu consigo madar paga o banco de dados mas tem um problema o campo está null?????


o meu código novo fico assim

[codebox]<select multiple=multiple id=s1>
<?php
//conexão com o BD
$sql = mysql_query ("Select * From cliente");
while ($x = mysql_fetch_array($sql)){
echo "<option value=\"".$x['codigo']."\">".$x['nome']."</value>\r\n";// o \r\n é só para organizar o HTML em linhas diferentes
}
?>
</select>

<br />
<input type=button value=SWAP onclick=forum(); />
<br />

<select name="s2" multiple=multiple id=s2>
</select>[/codebox]


:angry: :angry: :angry: :angry: :angry:

consegui arrumar mas a um problema quando cadastro no banco ele so ta pegando a primeira linha do list/menu obvio tem como arrumar isso????


[codebox]<select multiple=multiple id=s1>
<?php
//conexão com o BD
$sql = mysql_query ("Select * From cliente");
while ($x = mysql_fetch_array($sql)){
echo "<option value=\"".$x['nome']."\">".$x['nome']."</value>\r\n";// o \r\n é só para organizar o HTML em linhas diferentes
}
?>
</select>
<br />
<input type=button value=Adicionar onclick=forum(); />
<br />
<select name="s2" id="s2">
</select>
&nbsp;
<label>

</label>
[/codebox]

Edição feita por: webmastermichael, 28/10/2008, 15:19.





1 user(s) are reading this topic

0 membro(s), 1 visitante(s) e 0 membros anônimo(s)

IPB Skin By Virteq