Ir ao conteúdo
  • Cadastre-se

Problema com PHP


tuba_cwb

Posts recomendados

dae pessoal...

contratei uma empresa que fez um site pra mim com paginas tudo em PHP, e agora tem dado uns erros nos dados e eu não entendo nada de PHP. você podem me dizer onde que está o erro???

ele diz q o erro está na linha 1

<?php

require 'conn.php';

require 'header.php';

if ($_GET['action']=="form"){//se veio do form então faça a exclusão

$id_categoria = $_POST['id_cat'];

$sql2 = "delete from produtos where tipo=".$id_cat;

//$result = mysql_query($sql, $connection) or die (mysql_error());

$sql= "delete from categoria where id_cat=".$id_cat;

$result = mysql_query($sql, $connection) or die (mysql_error());

?>

<table width="45%" border="0" align="center" cellpadding="3" cellspacing="0">

<tr align="center">

<td colspan="2" class=titulo>CATEGORIA EXCLUÍDA COM SUCESSO</td>

</tr>

</table>

<?php

} else {//se não veio do form

$id_categoria = $_POST['id_cat'];

$sql= "select * from categoria where id_cat =".$id_categoria;

$result = mysql_query($sql, $connection);

if ($result){

while ($row=mysql_fetch_array($result)) {

$categoria = $row["categoria"];

}

?>

<form name="form1" method="post" action="del_cat.php">

<input type=hidden name="action" value="form">

<input type=hidden name="id_categoria" value="<?=$id_categoria?>">

<table width="40%" border="0" align="center" cellpadding="3" cellspacing="0">

<tr align="center">

<td colspan="2" class=titulo>EXCLUIR CATEGORIA SELECIONADA</td>

</tr>

<tr>

<td width="37%"> </td>

<td width="63%"> </td>

</tr>

<tr>

<td class=texto>Categoria:</td>

<td><input name="area" type="text" size="25" value="<?=$categoria?>" disabled></td>

</tr>

<tr align="center">

<td colspan="2">

<input type="submit" value="Excluir">

</td>

</tr>

</table>

</form>

<?php

} else {

?>

<table width="45%" border="0" align="center" cellpadding="3" cellspacing="0">

<tr align="center">

<td colspan="2" class=titulo>FALHA NA EXCLUSÃO</td>

</tr>

<tr>

<td width="25%"> </td>

<td width="75%"> </td>

</tr>

<tr>

<td colspan=2><a href=javascript:history.go(-1);>voltar</a></td>

</tr>

</table>

<?php

}

}

require 'bottom.php';

?>

valeu pessoal

Link para o comentário
Compartilhar em outros sites

brigado pela resposta Neto!!

tem esse arquivo sim.. na mesma pasta!!

o conteúdo dele é o seguinte:

<?php

$connection = mysql_connect("localhost", "usr_recozil", "webvpcl") or die ("não conectou");

$db = mysql_select_db("recozil", $connection) or die (" não selecionou");

?>

Link para o comentário
Compartilhar em outros sites

Se você puder informar a mensagem de erro que ele está dando fica mais fácil.

Quando colar código no fórum, coloca entre as tags code. Por exemplo:


<?php
require 'conn.php';
require 'header.php';

if ($_GET['action']=="form"){//se veio do form então faça a exclusão
$id_categoria = $_POST['id_cat'];

$sql2 = "delete from produtos where tipo=".$id_cat;
//$result = mysql_query($sql, $connection) or die (mysql_error());
$sql= "delete from categoria where id_cat=".$id_cat;
$result = mysql_query($sql, $connection) or die (mysql_error());
?>
<table width="45%" border="0" align="center" cellpadding="3" cellspacing="0">
<tr align="center">
<td colspan="2" class=titulo>CATEGORIA EXCLUÍDA COM SUCESSO</td>
</tr>


</table>
<?php
} else {//se não veio do form
$id_categoria = $_POST['id_cat'];
$sql= "select * from categoria where id_cat =".$id_categoria;
$result = mysql_query($sql, $connection);
if ($result){
while ($row=mysql_fetch_array($result)) {

$categoria = $row["categoria"];

}

?>
<form name="form1" method="post" action="del_cat.php">
<input type=hidden name="action" value="form">
<input type=hidden name="id_categoria" value="<?=$id_categoria?>">
<table width="40%" border="0" align="center" cellpadding="3" cellspacing="0">
<tr align="center">
<td colspan="2" class=titulo>EXCLUIR CATEGORIA SELECIONADA</td>
</tr>
<tr>
<td width="37%"> </td>
<td width="63%"> </td>
</tr>
<tr>
<td class=texto>Categoria:</td>
<td><input name="area" type="text" size="25" value="<?=$categoria?>" disabled></td>
</tr>

<tr align="center">
<td colspan="2">
<input type="submit" value="Excluir">
</td>
</tr>
</table>
</form>
<?php
} else {
?>
<table width="45%" border="0" align="center" cellpadding="3" cellspacing="0">
<tr align="center">
<td colspan="2" class=titulo>FALHA NA EXCLUSÃO</td>
</tr>
<tr>
<td width="25%"> </td>
<td width="75%"> </td>
</tr>


<tr>
<td colspan=2><a href=javascript:history.go(-1);>voltar</a></td>

</tr>
</table>
<?php
}
}
require 'bottom.php';
?>

Link para o comentário
Compartilhar em outros sites

Arquivado

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

Sobre o Clube do Hardware

No ar desde 1996, o Clube do Hardware é uma das maiores, mais antigas e mais respeitadas comunidades sobre tecnologia do Brasil. Leia mais

Direitos autorais

Não permitimos a cópia ou reprodução do conteúdo do nosso site, fórum, newsletters e redes sociais, mesmo citando-se a fonte. Leia mais

×
×
  • Criar novo...

Ebook grátis: Aprenda a ler resistores e capacitores!

EBOOK GRÁTIS!

CLIQUE AQUI E BAIXE AGORA MESMO!