Ir para conteúdo

Arquivado

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

Tiago Mello

Excluindo registro do Banco de Dados

Recommended Posts

Eu faço assim:

 

Ve ae se da certo:

<?php
$fornecedor = $_POST['fornecedor'];
include "Config/config_sistema.php";

// faz consulta no banco
$consulta = @mysql_query("select c.*, s.* from fornecedores c, certificado s where c.Fornecedor = '$fornecedor' and s.fornecedor = c.fornecedor");
?>
<!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=utf-8" />
<title>Untitled Document</title>
</head>
<link rel="StyleSheet" type="text/css" href="folhas.css">
<body>
                         <table width="95%" border="0" cellspacing="0" cellpadding="0" align="center">
                           <tr>
                             <td align="center" class="textohome_titulo"><?php echo $fornecedor; ?></td>
                       </tr>
               <tr>
               <td align="right"><a href="index.php?limk" class="textocentro">SAIR   </a></td>
               </tr>
               <tr>
                             <td align="center"></td>
                       </tr>
               <tr>
                             <td align="center"><table width="95%" border="0" cellspacing="0" cellpadding="0">
                               <tr>
                                 <td align="center" class="textomeio">Equipamento</td>
                                 <td align="center" class="textomeio">Data</td>
                                 <td align="center" class="textomeio">Código. Cert.</td>
                                 <td align="center" class="textomeio">Baixar</td>
                           </tr>
                   <tr>
                   <?php
while($linha = @mysql_fetch_array($consulta)) {

$id  =  $linha["id_certificado"];
$dt  =  $linha["data"];
$nc  =  $linha["numero_certificado"];
$arq =  $linha["pdf"];
?>

                                 <td align="center" class="textomeiotabela2"><?php echo $id; ?></td>
                                 <td align="center" class="textomeiotabela2"><?php echo $dt; ?></td>
                                 <td align="center" class="textomeiotabela2"><?php echo $nc; ?></td>
                                 <td align="center"><a href="/fotos/<?php echo $arq;?>" class="textocentro" target="_blank"></a><a href="teste_qualipar/fotos/<?php echo $arq;?>" class="link" target="_blank"><?php echo $arq;?></a></td>
                  <td><a class="link" href="teste_qualipar/deleta_usuario.php?<?php echo $id;?>">Excluir</a></td>
                   </tr>
                   <?php } ?>

                         </table></td>
                       </tr>
                     </table>
</body>
</html>

Compartilhar este post


Link para o post
Compartilhar em outros sites

pois é,é parecido com a minha forma, mas é uma coisa estranha, na url, quando passa o mouse, ele passa os valores certinhos, mas dai, quando clico, ele me diz que esse objeto não foi encontrado.

O que pode ser esse erro?

Compartilhar este post


Link para o post
Compartilhar em outros sites

Cara entao deve ser o exclui que ta com pau, tenta colocar esse codigo que eu uso aqui e da certo:

<?php

include "../Config/config_sistema.php";

$id_busca = $_GET['id_certificado'];

$sql = @mysql_query("SELECT * FROM tab_calenario_comercial WHERE id = $id_busca");

$linha = @mysql_num_rows($sql);

$sql = @mysql_query("DELETE FROM tab_calendario_comercial WHERE id = $id_busca");

if($sql){

    header("Redireciona a pagina para onde você quiser");

}else{

    print "Não foi possivel deletar o redado. Tente mais tarde!";

}

?>
Muda o nome da tabela no SELECT e no DELETE que eu esqueci.

Compartilhar este post


Link para o post
Compartilhar em outros sites

Cara, me retornou esse erro aqui:

 

Warning: include() [function.include]: Filename cannot be empty in C:\xampp\htdocs\qualipar_novo\Admin\index.php on line 37

 

Warning: include() [function.include]: Failed opening '' for inclusion (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\qualipar_novo\Admin\index.php on line 37

Compartilhar este post


Link para o post
Compartilhar em outros sites

nele eu tenho o seguinte:

<!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=utf-8" />
<title>Qualipar Soluções Dedicadas</title>
</head>
<body>
<table width="620" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td><?php include "topo.php"; ?></td>
  </tr>
  <tr>
    <td><?php include "menu.php"; ?></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF"><?php
			
			$link = $_GET[link];			
			
			$pag[1] = "home.php";
			$pag[2] = "teste_qualipar/form_conta.php";
			$pag[3] = "teste_qualipar/insere.php";
			$pag[4] = "teste_qualipar/cadastra_certificado.php";
			$pag[5] = "teste_qualipar/excluir.php";
			$pag[6] = "teste_qualipar/acao_excluir.php";
			$pag[7] = "teste_qualipar/deletar_usuario.php";
			
			if (!empty ($link)) //Se a variavel link não estiver vazia
			{
				if (file_exists($pag[$link])) //se o arquivo existir 
				{
					include $pag[$link]; // inclua o arquivo
				}
				else
				{
					
					include $pag[$link];
				}
			}
			else
			{
				include "home.php";
			}
			?></td>
  </tr>
  <tr>
    <td><?php include "rodape.php"; ?></td>
  </tr>
</table>

</body>
</html>

Compartilhar este post


Link para o post
Compartilhar em outros sites

Execute a query exibindo o erro com o mysql_error(). Algo assim:

$sql = mysql_query("DELETE FROM tab_calendario_comercial WHERE id = $id_busca") or die(mysql_error());

Vai aparecer o erro do MySQL.

 

Carlos Eduardo

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.