Ir para conteúdo
Fórum Script Brasil

ferspaik

Membros
  • Total de itens

    13
  • Registro em

  • Última visita

Tudo que ferspaik postou

  1. pessoal, estou com um probleminha, estou com um RecordSet montado dessa forma: SELECT prod_id, prod_codigo, prod_descricao, prod_preco FROM adm_produtos WHERE prod_status = 1 ORDER BY prod_id ASC dae tenho um campo em meu formulário q é um select de nome de produtos: <td><select name="serial_produto_id" id="serial_produto_id"> <?php do { ?> <option value="<?php echo $row_RsProdutos['prod_id']?>"<?php if (!(strcmp($row_RsProdutos['prod_id'], KT_escapeAttribute($row_rsadm_seriais['serial_produto_id'])))) {echo "selected=\"selected\"";} ?>><?php echo $row_RsProdutos['prod_descricao'] ?></option> <?php } while ($row_RsProdutos = mysql_fetch_assoc($RsProdutos)); $rows = mysql_num_rows($RsProdutos); if($rows > 0) { mysql_data_seek($RsProdutos, 0); $row_RsProdutos = mysql_fetch_assoc($RsProdutos); } ?> </select> até ai tudo bem, tudo funcionando perfeitamente, porém, eu preciso criar uma variavel para armazenar o valor do produto selecionado no menu, para ser inserido no campo: <input type="hidden" name="serial_valor" id="serial_valor" value="$VariavelValor" /> onde $VariavelValor é o que eu estou sem a mínima ideia de como fazer, já tentei com IF mas não deu muito certo, ele só armazena o valor do $_POST('serial_id') somente após eu dar o submit no formulario, alguém pode me ajudar?
  2. ola amigos, venho eu mais uma vez importuna-los rsrsrs amigos preciso do seguinte, preciso listar varios registros de um usuario, ate ai ok, um Recordset resolve meu problema, porem, preciso listar, o usuario selecionar varios e marcar uma caixa apenas como sim, e ele atualizar automaticos os registros a serem atualizados... mais ou menos dessa forma: 3200000433455 3200000433456 3200000433457 3200000433458 3200000433459 3200000433460 ativar [] sim 3200000433461 3200000433462 3200000433463 3200000433464 3200000433465 na pratica, preciso q o php pegue os registros selecionados pelo usuario, e atualize o campo na tabela, de 0 para 1, de todos os selecionados, automaticamente...
  3. não amigo, eu preciso atualizar os dados, da tabela, em sequencia, mas comecando do ID q eu inserir, e inserir uma quantidade de registro apos esse, por exemplo, 10 registros, ele atualize 10 registros apartir do ID 20 por exemplo, dae ele atualize do ID 20 ate o ID 29, porque inseri 10 se tivesse inserido 20, ele atualizaria 20, e assim por diante...
  4. pessoal, meu problema anterior eu consegui solucionar graças ao eSerra aqui do forum, porém agora estou com outro problema do mesmo tipo, eu preciso atualizar dados da tabela, em sequencia tb, estou tentando usar o mesmo script q utilizei no anterior, porém ele só está atualizando o serial q ele pega via URL, os demais ele não atualiza, será q alguém pode dar uma luz? mysql_select_db($database_alexandre, $alexandre); $query_RsSeriais = sprintf("SELECT * FROM adm_seriais WHERE serial_n_serie = %s", GetSQLValueString($colname_RsSeriais, "text")); $RsSeriais = mysql_query($query_RsSeriais, $alexandre) or die(mysql_error()); $row_RsSeriais = mysql_fetch_assoc($RsSeriais); $totalRows_RsSeriais = mysql_num_rows($RsSeriais); for($quantidade=1; $quantidade <= $_POST['quantidade']; $quantidade++) { mysql_select_db($database_alexandre, $alexandre) or die(mysql_error()); $soma = $_GET['serial_inicial']+$quantidade; $usuario = $_POST['serial_usu_id']; $qsqlseriais = ("UPDATE adm_seriais SET serial_usu_id='".$usuario."', serial_consignado='1', serial_ativado='0', serial_vendido='0'"); $sqlseriais = mysql_query($qsqlseriais, $alexandre) or die(mysql_error()); }
  5. pessoal, consegui resolver parte do meu problema, agora ele insere, só q ainda estou com um pequeno BUG, por exemplo, se eu escolher 50 inserções, começando do numero 1, a primeira inserção fica em branco no BD, dae ele começa do 1, 2, 3, 4, 5, 6, etc.... e para na inserção 49, ou seja, ele faz 50 inserções, porém a primeira dela fica em branco.... alguém consegue enxergar esse erro no codigo?: <?php require_once('Connections/alexandre.php'); ?> <?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 adm_seriais (serial_produto_id, serial_n_serie) VALUES (%s, %s)", GetSQLValueString($_POST['serial_produto_id'], "text"), GetSQLValueString($_POST['serial_n_serie'], "text")); mysql_select_db($database_alexandre, $alexandre); $Result1 = mysql_query($insertSQL, $alexandre) or die(mysql_error()); } $colname_RsSeriais = "-1"; if (isset($_POST['serial_n_serie'])) { $colname_RsSeriais = (get_magic_quotes_gpc()) ? $_POST['serial_n_serie'] : addslashes($_POST['serial_n_serie']); } mysql_select_db($database_alexandre, $alexandre); $query_RsSeriais = sprintf("SELECT * FROM adm_seriais WHERE serial_n_serie = %s", GetSQLValueString($colname_RsSeriais, "int")); $RsSeriais = mysql_query($query_RsSeriais, $alexandre) or die(mysql_error()); $row_RsSeriais = mysql_fetch_assoc($RsSeriais); $totalRows_RsSeriais = mysql_num_rows($RsSeriais); for($entradas=1; $entradas <= $_POST['entradas']; $entradas++) { mysql_select_db($database_alexandre, $alexandre); $qsqlseriais = "INSERT INTO adm_seriais (serial_produto_id, serial_n_serie) VALUES ('".$_POST['serial_produto_id']."', '".$soma."')"; $sqlseriais = mysql_query($qsqlseriais, $alexandre); echo "Entrada: ". $entradas . "<br>"; echo "ID: ".$_POST['serial_produto_id']. "<br>"; $soma = $_POST['serial_n_serie']+$entradas; echo "Serial: ". $soma. "<br>"; } ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Cadastro de Seriais</title> </head> <body> <form method="post" name="form1" action="<?php echo $editFormAction; ?>"> <table align="center"> <tr valign="baseline"> <td nowrap align="right">Produto:</td> <td nowrap align="right"> <div align="left"> <select name="serial_produto_id" id="serial_produto_id"> <option value="Cartão 10U$">Cartão 10U$</option> <option value="Cartão 25U$">Cartão 25U$</option> <option value="Cartão 50U$">Cartão 50U$</option> </select> </div></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right">Serial Inicial: </td> <td nowrap="nowrap" align="right"><input type="text" name="serial_n_serie" value="" size="32" /></td> </tr> <tr valign="baseline"> <td nowrap align="right">Entradas: </td> <td nowrap align="left"> <select name="entradas" id="entradas"> <option value="1">01 Entrada</option> <option value="5">05 Entradas</option> <option value="10">10 Entradas</option> <option value="20">20 Entradas</option> <option value="30">30 Entradas</option> <option value="40">40 Entradas</option> <option value="50">50 Entradas</option> </select> </td> </tr> <tr valign="baseline"> <td nowrap align="right">&nbsp;</td> <td nowrap align="right"><input name="submit" type="submit" value="Inserir" /></td> </tr> </table> <input type="hidden" name="MM_insert" value="form1"> </form> <p>&nbsp;</p> </body> </html> <?php mysql_free_result($RsSeriais); ?>
  6. sim, no echo aparece todos os inserts, dependo da quantidade q escolho, vou testar aqui o que você disse e já respondo novamente ok, a fonte do problema 'e essa, ele não esta cadastrando em serie, na hr do cadastro ele tenta cadastrar novamente o mesmo numero...
  7. sim, no echo aparece todos os inserts, dependo da quantidade q escolho, vou testar aqui o que você disse e já respondo novamente
  8. Pessoal, consegui o comando FOR, mas algum expert ai poderia me ajudar com ele, coloquei um echo para ver o que acontecia, ele esta rodando, mas não esta dando as entradas como desejado, ele da somente 1 entrada para mim, a segunda ele da entrada em branco no BD, e não da mais entradas.... <?php require_once('Connections/alexandre.php'); ?> <?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 adm_seriais (serial_produto_id, serial_n_serie) VALUES (%s, %s)", GetSQLValueString($_POST['serial_produto_id'], "text"), GetSQLValueString($_POST['serial_n_serie'], "text")); mysql_select_db($database_alexandre, $alexandre); $Result1 = mysql_query($insertSQL, $alexandre) or die(mysql_error()); } $colname_RsSeriais = "-1"; if (isset($_POST['serial_n_serie'])) { $colname_RsSeriais = (get_magic_quotes_gpc()) ? $_POST['serial_n_serie'] : addslashes($_POST['serial_n_serie']); } mysql_select_db($database_alexandre, $alexandre); $query_RsSeriais = sprintf("SELECT * FROM adm_seriais WHERE serial_n_serie = %s", GetSQLValueString($colname_RsSeriais, "int")); $RsSeriais = mysql_query($query_RsSeriais, $alexandre) or die(mysql_error()); $row_RsSeriais = mysql_fetch_assoc($RsSeriais); $totalRows_RsSeriais = mysql_num_rows($RsSeriais); for($entradas=0; $entradas <= $_POST['entradas']; $entradas++) { mysql_select_db($database_alexandre, $alexandre); $qsqlseriais = "INSERT INTO adm_seriais (serial_produto_id, serial_n_serie) VALUES ('".$_POST['serial_produto_id']."', '".$_POST['serial_n_serie']."')"; $sqlseriais = mysql_query($qsqlseriais, $alexandre); echo "Entrada: ". $entradas . "<br>"; echo "ID: ".$_POST['serial_produto_id']. "<br>"; $soma = $_POST['serial_n_serie']+$entradas; echo "Serial: ". $soma. "<br>"; } ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <body> <form method="post" name="form1" action="<?php echo $editFormAction; ?>"> <table align="center"> <tr valign="baseline"> <td nowrap align="right">Produto:</td> <td nowrap align="right"><input type="text" name="serial_produto_id" value="" size="32" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right">Serial Inicial: </td> <td nowrap="nowrap" align="right"><input type="text" name="serial_n_serie" value="" size="32" /></td> </tr> <tr valign="baseline"> <td nowrap align="right">Entradas: </td> <td nowrap align="left"> <select name="entradas" id="entradas"> <option value="1">01 Entrada</option> <option value="5">05 Entradas</option> <option value="10">10 Entradas</option> <option value="20">20 Entradas</option> <option value="30">30 Entradas</option> <option value="40">40 Entradas</option> <option value="50">50 Entradas</option> </select> </td> </tr> <tr valign="baseline"> <td nowrap align="right">&nbsp;</td> <td nowrap align="right"><input name="submit" type="submit" value="Inserir" /></td> </tr> </table> <input type="hidden" name="MM_insert" value="form1"> </form> <p>&nbsp;</p> </body> </html> <?php mysql_free_result($RsSeriais); ?>
  9. pessoal, estou com um problema, preciso criar uma pagina, para inserir numeros em serie, por exemplo: 10500, 10501, 10502, 10503 etc....... e assim por diante, mas como preciso inserir mais de 300 sempre, queria fazer uma pagina q eu colocasse o primeiro valor, e ele automaticamente gravasse as mesmas informações em serie, repetindo apenas o campo nome, por exemplo: CARTÃO RECARGA TIM DE 10 REAIS, número de série 10500789, dae ele gravasse sei lá, 50 registros identicos no banco de dados, alterando apenas o ultimo numero do cartao, ficando assim na tabela do BD: Banco de Dados ------ tabela: num_seriais ----- Campo1: serial_id -------- Campo2: serial_nome -------Campo3: serial_numero campo1=1 campo2=Cartão de R$10 campo3=10500789 campo1=2 campo2=Cartão de R$10 campo3=10500790 campo1=3 campo2=Cartão de R$10 campo3=10500791 campo1=4 campo2=Cartão de R$10 campo3=10500792 campo1=5 campo2=Cartão de R$10 campo3=10500793 campo1=6 campo2=Cartão de R$10 campo3=10500794 etc....... sou novo na linguagem, se alguém poder me ajudar, eu agradeço muiiiiito...
  10. pessoal, estou com um problema no meu script, mas não consigo achar o erro, quando rodo ele com um echo no RsInsertPedido me retorna isso: INSERT INTO adm_n_pedidos (np_sessao, np_cliente, np_status, np_cod_envio, np_detalhes, np_data_pedido) VALUES ('', '', '0', 'NULL', 'NULL', '2009/05/30') Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\wamp\www\alexandre3\finalizar.php on line 52 o que é super estranho uma vez q na tabela, np_sessao e np_cliente, são campos NOT NULL, e no BD ele grava sem nada ficando assim: np_id np_sessao np_cliente np_status np_cod_envio np_detalhes np_data_pedido 9 0 0 NULL NULL 2009/05/30 qual é o problema com meu script q ele não insere nem a sessao e nem o id do cliente? por favor é urgente! muito obrigado! <?php require_once('Connections/alexandre.php'); ?> <?php session_start(); $sessao = session_id(); if($sessao == "".session_id()."") { session_regenerate_id(); } 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; } } //******************************// mysql_select_db($database_alexandre, $alexandre); $query_RsVerificaPedido = "SELECT np_id FROM adm_n_pedidos WHERE np_sessao = '$sessao'"; $RsVerificaPedido = mysql_query($query_RsVerificaPedido, $alexandre) or die(mysql_error()); $row_RsVerificaPedido = mysql_fetch_assoc($RsVerificaPedido); $totalRows_RsVerificaPedido = mysql_num_rows($RsVerificaPedido); //**************// $npid = $row_RsVerificaPedido['np_id']; $usuid = $_SESSION['kt_login_id']; $data = date('Y/m/d'); //******************************************// if($npid == "") { //******************************************// mysql_select_db($database_alexandre, $alexandre); $query_RsInsertPedido = "INSERT INTO adm_n_pedidos (np_sessao, np_cliente, np_status, np_cod_envio, np_detalhes, np_data_pedido) VALUES ('$sessao', '$usuid', '0', 'NULL', 'NULL', '$data')"; $RsInsertPedido = mysql_query($query_RsInsertPedido, $alexandre) or die(mysql_error()); $row_RsInsertPedido = mysql_fetch_assoc($RsInsertPedido); //*****************************************// } //*********************************// mysql_select_db($database_alexandre, $alexandre); $query_RsListaPedido = "SELECT np_id FROM adm_n_pedidos WHERE np_sessao = '$sessao'"; $RsListaPedido = mysql_query($query_RsListaPedido, $alexandre) or die(mysql_error()); $row_RsListaPedido = mysql_fetch_assoc($RsListaPedido); $totalRows_RsListaPedido = mysql_num_rows($RsListaPedido); //*****************************// mysql_select_db($database_alexandre, $alexandre); $query_RsSomaTotal = "SELECT sum(ipd_preco *ipd_quantidade) as somatotal FROM adm_itens_pedido_ipd WHERE ipd_sessao = '$sessao'"; $RsSomaTotal = mysql_query($query_RsSomaTotal, $alexandre) or die(mysql_error()); $row_RsSomaTotal = mysql_fetch_assoc($RsSomaTotal); $totalRows_RsSomaTotal = mysql_num_rows($RsSomaTotal); ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>BRASILbet - Pedido Finalizado</title> <style type="text/css"> <!-- .style1 { color: #FFFFFF; font-weight: bold; } --> </style> </head> <body> <div id="status" style="padding-top:10px; padding-bottom:10px; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:16px; color:#333333"> &raquo; <span class="style3">Meus Pedidos</span> <span class="style3">&raquo; Entrega <strong>&raquo; Finalizado </strong></span></div> <table width="100%"> <tr> <td height="30" bgcolor="#000000"><div align="center" class="style1">Pedido Finalizado - N&uacute;mero: <?php echo $row_RsListaPedido['np_id']; ?></div></td> </tr> <tr> <td><p>O seu pedido foi realizado com sucesso.</p> <p>Valor Total do pedido: </p> <p>Lembrando que somente ser&aacute; cobrado o valor dos cart&otilde;es que forem solicitados a ativa&ccedil;&atilde;o do mesmo. <br /> </p></td> </tr> </table> </body> </html> <?php mysql_free_result($RsSomaTotal); mysql_free_result($RsListaPedido); mysql_free_result($RsVerificaPedido); ?>
  11. ferspaik

    ajuda com if else

    ola galera, sou novo na linguagem php, deixa eu tentar esclarecer o que preciso... tenho um BD cujo tem 2 tabelas de cadastro de usuarios, em uma delas tem nome, email, senha etc... na outra tem o endereço, preciso de uma pagina para o usuario cadastrar seu endereço, mas somente se o usu_id (q é a chave da tabela endereço) não estiver cadastrado com endereço dele, caso contrario, ele abra o formulario para completar o endereço, fiz umas tentativas aqui, vou colocar o codigo... <?php if(!isset($row_rsadm_endereco_entrega['ecl_usu_id'])) { ?> <tr bgcolor="#000000"> <td height="30"><div align="center" class="style1">Dados de Entrega </div></td> </tr> <tr> <td>&nbsp; <?php echo $tNGs->getErrorMsg(); ?> <form method="post" id="form1" action="<?php echo KT_escapeAttribute(KT_getFullUri()); ?>"> <table align="center" cellpadding="2" cellspacing="0" class="KT_tngtable"> <tr> <td class="KT_th"><label for="ecl_nomecompleto">Nome Completo:</label></td> <td><input name="ecl_nomecompleto" type="text" id="ecl_nomecompleto" value="<?php echo KT_escapeAttribute($row_rsadm_endereco_entrega['ecl_nomecompleto']); ?>" size="50" maxlength="50" /> <?php echo $tNGs->displayFieldHint("ecl_nomecompleto");?> <?php echo $tNGs->displayFieldError("adm_endereco_entrega", "ecl_nomecompleto"); ?> </td> </tr> <tr> <td class="KT_th"><label for="ecl_rua">Rua/Av.:</label></td> <td><input name="ecl_rua" type="text" id="ecl_rua" value="<?php echo KT_escapeAttribute($row_rsadm_endereco_entrega['ecl_rua']); ?>" size="50" maxlength="50" /> <?php echo $tNGs->displayFieldHint("ecl_rua");?> <?php echo $tNGs->displayFieldError("adm_endereco_entrega", "ecl_rua"); ?> </td> </tr> <tr> <td class="KT_th"><label for="ecl_numero">Número:</label></td> <td><input name="ecl_numero" type="text" id="ecl_numero" value="<?php echo KT_escapeAttribute($row_rsadm_endereco_entrega['ecl_numero']); ?>" size="10" maxlength="10" /> <?php echo $tNGs->displayFieldHint("ecl_numero");?> <?php echo $tNGs->displayFieldError("adm_endereco_entrega", "ecl_numero"); ?></td> </tr> <tr> <td class="KT_th"><label for="ecl_bairro">Bairro:</label></td> <td><input name="ecl_bairro" type="text" id="ecl_bairro" value="<?php echo KT_escapeAttribute($row_rsadm_endereco_entrega['ecl_bairro']); ?>" size="30" maxlength="30" /> <?php echo $tNGs->displayFieldHint("ecl_bairro");?> <?php echo $tNGs->displayFieldError("adm_endereco_entrega", "ecl_bairro"); ?> </td> </tr> <tr> <td class="KT_th"><label for="ecl_complemento">Complemento:</label></td> <td><input name="ecl_complemento" type="text" id="ecl_complemento" value="<?php echo KT_escapeAttribute($row_rsadm_endereco_entrega['ecl_complemento']); ?>" size="30" maxlength="30" /> <?php echo $tNGs->displayFieldHint("ecl_complemento");?> <?php echo $tNGs->displayFieldError("adm_endereco_entrega", "ecl_complemento"); ?> </td> </tr> <tr> <td class="KT_th"><label for="ecl_cidade">Cidade:</label></td> <td><input name="ecl_cidade" type="text" id="ecl_cidade" value="<?php echo KT_escapeAttribute($row_rsadm_endereco_entrega['ecl_cidade']); ?>" size="50" maxlength="50" /> <?php echo $tNGs->displayFieldHint("ecl_cidade");?> <?php echo $tNGs->displayFieldError("adm_endereco_entrega", "ecl_cidade"); ?> </td> </tr> <tr> <td class="KT_th"><label for="ecl_estado">UF:</label></td> <td><input name="ecl_estado" type="text" id="ecl_estado" value="<?php echo KT_escapeAttribute($row_rsadm_endereco_entrega['ecl_estado']); ?>" size="2" maxlength="2" /> <?php echo $tNGs->displayFieldHint("ecl_estado");?> <?php echo $tNGs->displayFieldError("adm_endereco_entrega", "ecl_estado"); ?> </td> </tr> <tr> <td class="KT_th"><label for="ecl_cep">CEP:</label></td> <td><input name="ecl_cep" type="text" id="ecl_cep" value="<?php echo KT_escapeAttribute($row_rsadm_endereco_entrega['ecl_cep']); ?>" size="15" maxlength="15" /> <?php echo $tNGs->displayFieldHint("ecl_cep");?> <?php echo $tNGs->displayFieldError("adm_endereco_entrega", "ecl_cep"); ?> </td> </tr> <tr class="KT_buttons"> <td colspan="2"><input name="KT_Insert3" type="submit" class="button" id="KT_Insert3" value="Continuar" /> </td> </tr> </table> <input type="hidden" name="ecl_usu_id" id="ecl_usu_id" value="<?php echo KT_escapeAttribute($row_rsadm_endereco_entrega['ecl_usu_id']); ?>" /> </form> <p>&nbsp;</p></td> </tr> <?php } else ?>
  12. tentei, da esse erro: Duplicate entry '2147483647' for key 'serial_n_serie' não sei onde ele pegou esse serial rsrsrs não tem nada no codigo dizendo isso, tentei deletar esse serial mas ele insere ele de novo, e somente ele... mas mesmo assim muito obrigado pela atencao... segue o codigo completo para facilitar... <?php require_once('../Connections/alexandre.php'); ?> <?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 adm_seriais (serial_produto_id, serial_n_serie) VALUES (%s, %s)", GetSQLValueString($_POST['serial_produto_id'], "text"), GetSQLValueString($_POST['serial_n_serie'], "int")); mysql_select_db($database_alexandre, $alexandre); $Result1 = mysql_query($insertSQL, $alexandre) or die(mysql_error()); } ?><table width="0" border="0"> <tr> <td><form method="post" name="form1" action="<?php echo $editFormAction; $serial_descricao = "produto"; $serial_n_serie = 1; $i = $serial_n_serie; while ( $i < ( $serial_n_serie + 100 ) ) $sql = "INSERT INTO adm_seriais ( serial_produto_id , serial_n_serie ) VALUES ( '{$serial_descricao}' , " . $i++ . ")"; ?>"> <table align="center"> <tr valign="baseline"> <td nowrap align="right">Produto::</td> <td><input type="text" name="serial_produto_id" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Serial_n_serie:</td> <td><input type="text" name="serial_n_serie" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right"> </td> <td><input type="submit" value="Inserir"></td> </tr> </table> <input type="hidden" name="MM_insert" value="form1"> </form> <p> </p></td> </tr> <tr> <td> </td> </tr> </table>
  13. ola pessoa, sou novo na area e no forum, estou precisando muito da ajuda de vocês, estou comecando agora na area, e estou desenvolvendo um sisteminha basico, porem preciso registrar seriais de numeros em serie e em grande quantidade, no BD esta assim serial_id, serial_descricao, serial_n_serie, onde o id é a chave da tabela, serial descricao é a descricao do produto, e n serie seria o seria, o serial tem 12 caracteres numericos, e preciso registrar pelo menos 100 de cada vez, o mesmo produto, em em serie, ex. produto 1 numero de serie 320000031530, produto 1 numero de serie 320000031531, produto 1 numero de serie 320000031532, e assim sucessivamente, preciso de um script para cadastrar automatico isso, de 50 em 50 ou de 100 em 100, porque são cerca de 1000 seriais para cadastrar sempre, e fazer isso 1 por 1 é foda não é? hehehehe valeu gente, aguardo a ajuda de vocês.
×
×
  • Criar Novo...