Ir para conteúdo
Fórum Script Brasil
  • 0

Não consigo deletar uma tabela


Brandow

Pergunta

eu estou com problema para deletar as tabelas por meio de um código php, eu aperto em excluir e a tabela não deleta.

códigos:

listar_usuários

<?php
// inclui o arquivo de validar sessão
// inclui o arquivo de configuração do sistema
include "config_sistema.php";

// faz consulta no banco de dados
$consulta = mysql_query("select * from cliques");
?>
<!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>
<style type="text/css">
<!--
.style1 {font-size: 36px}
.style2 {
    color: #000000;
    font-weight: bold;
}
.style3 {
    color: #FFFFFF;
    font-weight: bold;
}
-->
</style>
</head>

<body>
<form action="deletar_usuario.php" method="post" enctype="multipart/form-data">
<table width="732" border="0" cellpadding="0" cellspacing="0">
  <!--DWLayoutTable-->
  <tr>
    <td width="71" height="29"> </td>
    <td width="158"> </td>
    <td width="28"> </td>
    <td width="247"> </td>
    <td width="39"> </td>
    <td width="85"> </td>
    <td width="56"> </td>
    <td width="48"> </td>
  </tr>
  <tr>
    <td height="46"> </td>
    <td> </td>
    <td> </td>
    <td valign="top"><span class="style1">Lista de usuarios</span> </td>
    <td> </td>
    <td> </td>
    <td> </td>
    <td> </td>
  </tr>
  <tr>
    <td height="20"> </td>
    <td> </td>
    <td> </td>
    <td> </td>
    <td> </td>
    <td> </td>
    <td> </td>
    <td> </td>
  </tr>
  <tr>
    <td height="24"> </td>
    <td> </td>
    <td colspan="3" valign="middle" class="style2">Lista de usuarios | <a href="total_usuarios.php" 

class="style2">Total de cadastros</a> | <span class="style2"><a href="../logout.php" 

class="style2">Logout</a> </span></td>
    <td> </td>
    <td> </td>
    <td> </td>
  </tr>
  <tr>
    <td height="24"></td>
    <td></td>
    <td></td>
    <td></td>
    <td></td>
    <td></td>
    <td valign="top"><label for="Submit"></label>
      <input type="submit" name="deletar" value="deletar" id="deletar" /></td>
    <td></td>
  </tr>
  <tr>
    <td height="2"></td>
    <td></td>
    <td></td>
    <td></td>
    <td></td>
    <td></td>
    <td></td>
    <td></td>
  </tr>
  
  <tr>
    <td height="52"> </td>
    <td colspan="6" valign="top"><table width="100%" border="2" bordercolor="#FFFFFF" cellpadding="0" 

cellspacing="0">
      <!--DWLayoutTable-->
      <tr>
        <td width="258" height="24" align="center" valign="middle" bgcolor="#000000"><span 

class="style3">Nome:</span></td>
          <td width="278" align="center" valign="middle" bgcolor="#000000" class="style3">Site</td>
          <td width="67" align="center" valign="middle" bgcolor="#000000" class="style3">Excluir</td>
        </tr>
  <?php
while($linhas = mysql_fetch_object($consulta)) {
?>
      <tr>
        <td height="24" align="center" valign="middle" bgcolor="#CCCCCC"><?php echo 

$linhas->Nome;?> </td>
          <td align="center" valign="middle" bgcolor="#CCCCCC"><?php echo $linhas->url;?> </td>
          <td align="center" valign="middle" bgcolor="#CCCCCC" class="style2"><a 

href="deletar_usuario.php?=<?=$linhas->id;?>" class="style2">
            <input name="select" type="checkbox" id="select" value="<?php $linhas->id;?>" />
            <label for="checkbox"></label>
          </a></td>
        </tr>
      
  <?php
}
?>
      
      
      
      
    </table></td>
    <td> </td>
  </tr>
  <tr>
    <td height="136"> </td>
    <td> </td>
    <td> </td>
    <td> </td>
    <td> </td>
    <td> </td>
    <td> </td>
    <td> </td>
  </tr>
</table>
</form>
</body>
</html>
Deletar_usuário
<?php
include "config_sistema.php";

// recebe os dados do formulario
$codigo = (int) $_POST['id'];

// deleta o usuario
$consulta = mysql_query("delete from cliques where id='$id'");

// verifica se foi excluido o usuario
if($consulta) {
    $msg = urlencode("Usuário excluido com sucesso!");
    header("Location: listar_usuarios.php?msg=$msg");
    exit;
} else {
    $erro = urlencode("Não foi possivel excluir o contato!");
    header("Location: listar_usuarios.php?erro=$erro");
    exit;
}
?>

Link para o comentário
Compartilhar em outros sites

1 resposta a esta questão

Posts Recomendados

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,2k
    • Posts
      652k
×
×
  • Criar Novo...