Ir para conteúdo

POWERED BY:

Arquivado

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

fsales_123

editar por id

Recommended Posts

Bom dia estou fazendo uma seção de login, e não está puxando por id. Alguém pode me ajudar, estou fazendo dessa forma.

 

Pagina

sucesso.php

<div> <a href="entrada/atualizarregistro.php?id=<?php echo $row_atualizarregistro->ID; ?>">ATUALIZAR REGISTRO</a></div>

alterarregistro.php

<?php require_once('../../Connections/conexao.php');
$id = $_GET['id'];
 ?>
 

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Seção de Entrada</title>
<link href="../css/stilo.css" rel="stylesheet" type="text/css" media="all">
<link rel="stylesheet" type="text/css" href="../css/font-awesome.css">
<link rel="stylesheet" type="text/css" href="../css/menu.css">
<!-- <link href="../css/bootstrap.css" rel="stylesheet" type="text/css"> -->
<link href="../../css/bootstrap-3.3.4.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="../js/jquery.js"></script>
<script type="text/javascript" src="../js/function.js"></script>
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<?php
       $query = "select * from cliente where id='$id'";
$sql = mysql_query($query) or die(mysql_error());
while ($row_atualizarregistro = mysql_fetch_array($sql)) {
            ?>
<body style="background-color:#F7F7F7">
<div class="container-fluid" style="background-color:#272727; height:50px;"></div>
<div class="container-fluid">
<div class="row">
    <div class="col-md-6" style="background-color:#353535; width:300px; height:600px; border-bottom-left-radius:3px; border-bottom-right-radius:3px;">
      <div style="padding-left:25px; color:#F7F7F7; padding-top:15px; padding-bottom:10px; font-weight:bold; font-size:16px; font-family:Segoe, 'Segoe UI', 'DejaVu Sans', 'Trebuchet MS', Verdana, sans-serif;"> <a href="../sucesso.php">HOME</a></div>
      <div style="padding-left:35px; color:#F7F7F7; font-weight:600; font-family:Segoe, 'Segoe UI', 'DejaVu Sans', 'Trebuchet MS', Verdana, sans-serif;"> <a href="cadastrarempresa.php">CADASTRAR EMPRESA</a></div>
      <div style="padding-left:35px; color:#F7F7F7; font-weight:600; font-family:Segoe, 'Segoe UI', 'DejaVu Sans', 'Trebuchet MS', Verdana, sans-serif;"> <a href="editarempresa.php">EDITAR EMPRESA</a></div>
      <div style="padding-left:35px; color:#F7F7F7; font-weight:600; font-family:Segoe, 'Segoe UI', 'DejaVu Sans', 'Trebuchet MS', Verdana, sans-serif;"> <a href="atualizarregistro.php">ATUALIZAR REGISTRO</a></div>
      <div style="padding-left:35px; color:#F7F7F7; font-weight:600; font-family:Segoe, 'Segoe UI', 'DejaVu Sans', 'Trebuchet MS', Verdana, sans-serif;"><i class=""></i> <a href="<?php echo $logoutAction ?>">SAIR</a></div>
    </div>
    <div class="col-md-6" style="background-color:#F9F9F9; width:700px; height:600px; border:1px solid #A6A6A6; margin:3px; border-bottom-left-radius:3px;
border-bottom-right-radius:3px;
border-top-left-radius:3px;
border-top-right-radius:3px;">
    <div style="margin:10px; border-bottom:2px solid #9A9A9A; font-weight:bold;">ATUALIZAR REGISTRO</div>
      <form method="post" name="form1" action="<?php echo $editFormAction; ?>">
        <table align="center">
          <tr valign="baseline">
            <td nowrap align="right">NOME: </td>
            <td><input class="form-control" style="margin:3px;" type="text" name="cli_nome" value="<?php echo htmlentities($row_atualizarregistro['cli_nome'], ENT_COMPAT, 'utf-8'); ?>" size="32"></td>
          </tr>
          <tr valign="baseline">
            <td nowrap align="right">E-MAIL: </td>
            <td><input class="form-control" style="margin:3px;" type="text" name="cli_email" value="<?php echo htmlentities($row_atualizarregistro['cli_email'], ENT_COMPAT, 'utf-8'); ?>" size="32"></td>
          </tr>
          <tr valign="baseline">
            <td nowrap align="right">SENHA: </td>
            <td><input class="form-control" style="margin:3px;" type="text" name="cli_senha" value="<?php echo htmlentities($row_atualizarregistro['cli_senha'], ENT_COMPAT, 'utf-8'); ?>" size="32"></td>
          </tr>
          <tr valign="baseline">
            <td nowrap align="right"> </td>
            <td><input class="btn-group-lg" style="margin:3px; float:right;" type="submit" value="ATUALIZAR REGISTRO"></td>
          </tr>
        </table>
        <input type="hidden" name="MM_update" value="form1">
        <input type="hidden" name="id" value="<?php echo $row_atualizarregistro['id']; ?>">
      </form>
      <p> </p>
    </div>
  </div>
</div>
<?php
}
?>
</body>
</html>

no navegador ele aparece assim: http://localhost/pagina/entrada/atualizarregistro.php?id=

Compartilhar este post


Link para o post
Compartilhar em outros sites

Fiz no dreamweaver....

<?phpif (!isset($_SESSION)) {  session_start();}$MM_authorizedUsers = "";$MM_donotCheckaccess = "true";// *** Restrict Access To Page: Grant or deny access to this pagefunction 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 = "erropaginarestring.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($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0)   $MM_referrer .= "?" . $_SERVER['QUERY_STRING'];  $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);  header("Location: ". $MM_restrictGoTo);   exit;}?><?phpif (!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_update"])) && ($_POST["MM_update"] == "form1")) {  $updateSQL = sprintf("UPDATE cliente SET cli_nome=%s, cli_email=%s, cli_senha=%s WHERE id=%s",                       GetSQLValueString($_POST['cli_nome'], "text"),                       GetSQLValueString($_POST['cli_email'], "text"),                       GetSQLValueString($_POST['cli_senha'], "text"),                       GetSQLValueString($_POST['id'], "text"));  mysql_select_db($database_conexao, $conexao);  $Result1 = mysql_query($updateSQL, $conexao) or die(mysql_error());  $updateGoTo = "atulizacaosucesso.php";  if (isset($_SERVER['QUERY_STRING'])) {    $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";    $updateGoTo .= $_SERVER['QUERY_STRING'];  }  header(sprintf("Location: %s", $updateGoTo));}mysql_select_db($database_conexao, $conexao);$query_atualizarregistro = "SELECT * FROM cliente";$atualizarregistro = mysql_query($query_atualizarregistro, $conexao) or die(mysql_error());$row_atualizarregistro = mysql_fetch_assoc($atualizarregistro);$totalRows_atualizarregistro = mysql_num_rows($atualizarregistro);mysql_select_db($database_conexao, $conexao);$query_id = "SELECT * FROM cliente WHERE cliente.id";$id = mysql_query($query_id, $conexao) or die(mysql_error());$row_id = mysql_fetch_assoc($id);$totalRows_id = mysql_num_rows($id);?>

ALGUÉM?

Compartilhar este post


Link para o post
Compartilhar em outros sites

  • Conteúdo Similar

    • Por Carlos Web
      Olá...
      Estou tentando fazer o seguinte !!
      Listando dados em tabela !!
      Gostaria que....se na listagem houver 4 linhas...indepedente de seu número de ID, faça a listagem em ID ser em ordem 1 2 3 4 !!
      Exemplo...se tiver uma listagem de dados que está em ID 1 3 3...faça ficar 1 2 3 !!

       
      echo "<table class='tabela_dados' border='1'> <tr> <td>ID</td> <td>Nome Empresa</td> <td>Responsável</td> <td>Telefone 1</td> <td>Telefone 2</td> <td>E-mail 1</td> <td>E-mail 2</td> <td>Endereço</td> <td>CEP</td> <td>Bairro</td> <td>AÇÃO 1</td> <td>AÇÃO 2</td> </tr> "; $sql = "SELECT ID FROM usuarios_dados WHERE Usuario='$usuario'"; $result = $conn->query($sql); $num_rows = $result->num_rows; $Novo_ID = 1; for ($i = 0; $i < $num_rows; $i++) { $registro = $result -> fetch_row(); $sql2 = "UPDATE usuarios_dados SET ID='$Novo_ID' WHERE ID='$Novo_ID'"; $result2 = $conn->query($sql2); $Novo_ID++; } $sql = "SELECT * FROM usuarios_dados"; $result = $conn->query($sql); if ($result->num_rows > 0) { // output data of each row while($row = $result->fetch_assoc()) { echo "<tr> <td>$row[ID]</td> <td>$row[Nome_Empresa]</td> <td>$row[Responsavel]</td> <td>$row[Telefone_1]</td> <td>$row[Telefone_2]</td> <td>$row[Email_1]</td> <td>$row[Email_2]</td> <td>$row[Endereço]</td> <td>$row[CEP]</td> <td>$row[Bairro]</td> <td> <form method='post' action='Editar_Dados.php'> <input type='hidden' name='usuario' value='$usuario'> <input type='hidden' name='senha' value='$senha'> <input type='hidden' name='ID' value='$row[ID]'> <input type='submit' style='padding: 10px;' value='EDITAR'> </form> </td> <td> <form method='post' action='Deletar_Dados.php'> <input type='hidden' name='usuario' value='$usuario'> <input type='hidden' name='senha' value='$senha'> <input type='hidden' name='ID' value='$row[ID]'> <input type='submit' style='padding: 10px;' value='DELETAR'> </form> </td> </tr> "; } } else { echo "0 results"; } $conn->close();  
    • Por Carlos Antoliv
      Olá, senhores.
       
      Sei que existem diversos tópicos por aí sobre esse assunto, contudo, não consegui solucionar o problema, mesmo depois de 1 dia tentando fazer algo até simples.
       
      Seguinte, estou pegando o id de um produto e tentando jogar em outra tabela, pelo checkbox.
      ex:
       
      id    produto
      23   lapis
      43  caneta
       
      pelo checkbox, a pessoa escolhe o produto e adicona em uma lista, que é outro banco. Se pessoa selecionar mais de 1 item da lista, o laço só envia para o banco apenas 1 item de qualquer forma.
       
      Vou postar o Código:
       
      Código do INSERT:
       
          $check1 = (isset($_POST["check"]) && $_POST["check"] != null) ? $_POST["check"] : "";     foreach($check1 as $check){                         $stmt = $conexao->prepare("INSERT INTO tb_itemProdKit (fk_tb_kit, fk_usuarios, fk_tb_produtos) VALUES (?, ?, ?)");                  $stmt->bindParam(1, $nome_prod);         $stmt->bindParam(2, $idSessao);         $stmt->bindParam(3, $check);                if ($stmt->execute()) {             if ($stmt->rowCount() > 0) {                 echo "Dados cadastrados com sucesso!";                 $id_prod = null;                 $nome_prod = null;                 $idSessao = null;                 $check = null;                             header("Location: item-produto-kit.php");exit;                              } else {                 echo "Erro ao tentar efetivar cadastro";             }         } else {                throw new PDOException("Erro: Não foi possível executar a declaração sql");         }     } } } catch (PDOException $erro) {         echo "Erro: " . $erro->getMessage();     }    
       
      Agora o código do checkbox:
       
             if ($stmt->execute()) {                 while ($rs = $stmt->fetch(PDO::FETCH_OBJ)) {                       echo "<tr>";                     echo "<td><input type='checkbox' name='check[]' id='check' value='".$rs->id_prod."'</td><td class='lista_usuario'>".$rs->nome_produto."</td><td class='lista_usuario'>".$rs->desc_prod."</td><td class='lista_usuario'>".$rs->peso_liq_prod                                ."</td>"                                ;                     echo "</tr>";                 }             }else {                 echo "Erro: Não foi possível recuperar os dados do banco de dados";             }     } catch (PDOException $erro) {         echo "Erro: ".$erro->getMessage();     }     echo "</form>"    
          ?>  
       
       
      Está cadastrando apenas 1 item e não múltiplos itens.
       
      abço!!
       
       
       
       
       
    • Por douglas79
      Bom dia,
       
      Estou seguindo uma vídeo aula no Youtube e o instrutor lá colocou uma sequência de div's (seja id ou class), o seletor background não funciona.

      Vou postar o código até o momento:
       
      @charset "utf-8";
       
      body, ul{padding:0;margin:0;background: #e2e2e2;list-style: none;}
      #geral{overflow: hidden;}
      #geral #topo{width:1018px;margin:0 auto;overflow: hidden;}
      #geral #topo #logo, #menuTopo{float:left;width:400px;}
      #geral #topo #logo{background:#ccc;}
      #geral #topo #menuTopo{}
      #geral #topo #menuTopo li{float:left;padding:5px;}

      Alguém pode me tirar essa dúvida???
      Desde já, agradeço!
    • Por Gildvan Arley
      <?php $consulta = $conexao->query('SELECT * FROM nomevip '); while ($exibir=$consulta->fetch(PDO::FETCH_ASSOC)){ ?> Olá
      Como posso remover 13 ids desse SELECT do 1 ao 13 
    • Por denys017
      Bom dia, boa tarde ou boa noite, bem o que quero fazer é o seguinte eu salvei o nome de algumas imagens no banco e quero ligar elas a um id de usuario, para que na hora de exibir as imagens só exiba as imagens que estejam ligadas/cadastradas com aquele usuario, resumindo quero saber como faço para ligar os campos das imagens cadastrada ao campo do usuario no sql.
×

Informação importante

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