Database Not Updated

I have this code, however it does not update the database…please need help…


<form method="POST" action="listforn.php" name="funcionarios">

Numero: <input type="text" name="palavra"/>

<input type="text" name="mensagem">

<input type="submit" value="Buscar"/>




<TITLE>Documento PHP</TITLE>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="estilos/main.css" />
<script type="text/javascript">
function delRecord(codpessoa) {
var teste = confirm("Tem certeza que quer excluir o registro?");
if (teste==false) {
window.location = "listforn.php";
else window.location = "delforn.php?cod="+codpessoa;
<table id="data">
<caption>Listagem de Funcionários</caption>

# Conexão ao servidor MySQL
# e seleção do banco Web21
$palavra = $POST'palavra';
$sql="select from pfunc where id = ".$palavra."";
$query = mysqlquery($sql);
while ($linha = mysqlfetcharray($query)) {
echo "<tr>";
echo "<td>$linhaid</td>";
echo "<td>$linhacodcoligada</td>";
echo "<td>$linhacodpessoa</td>";
echo "<td>$linhachapa</td>";
echo "<td>$linhacodsecao</td>";
echo "<td>$linhanome</td>";
echo "<td>$linhapisparafgts</td>";
echo "<td style='text-align:center'>";
echo "<a href='javascript:delRecord(".$linha'id'.");'>X</a>";
echo "</td>";
echo "<td style='text-align:center'>";
echo "<a href='altforn.php?cod=".$linha'id'."'>";
echo "<img src='imagens/edit.png' border='0' width='16' height='16' /></a>";
echo "</td>";
echo "</tr>\



<TITLE>Documento PHP</TITLE>
$sql="select from pfunc where id = '$GETcod'";
$query = mysqlquery($sql);
$linha = mysqlfetcharray($query);
<h1>Cadastro de Fornecedores</h1>
<form id="form1" name="form1" method="post" action="doaltforn.php">
<input type="text" name="id" readonly="readonly" value="<?php echo $linha'id';?>" /><br />
<input type="text" name="codpessoa" readonly="readonly" value="<?php echo $linha'codpessoa';?>" /><br />
<label for="nome">Nome:</label>
<input type="text" name="nome" id="nome" value="<?php echo $linha'nome';?>" /><br />
<label for="nome">Coligada:</label>
<input type="text" name="codcoligada" id="codcoligada" value="<?php echo $linha'codcoligada';?>" /><br />
<label for="nome">Chapa:</label>
<input type="text" name="chapa" id="chapa" value="<?php echo $linha'chapa';?>" /><br />
<label for="nome">Seção:</label>
<input type="text" name="codsecao" id="codsecao" value="<?php echo $linha'codsecao';?>" /><br />
<label for="nome">Pis:</label>
<input type="text" name="pisparafgts" id="pisparafgts" value="<?php echo $linha'pisparafgts';?>" /><br />
<input name="enviar" type="submit" value="Alterar" />


$ideditar = (int)$GET'cod';
$nome = $POST'nome';
$codcoligada = $POST'codcoligada';
$chapa = $POST'chapa';
$codsecao = $POST'codsecao';
$pisparafgts = $POST'pisparafgts';

$sql = "UPDATE pfunc SET nome = '$nome', codcoligada = '$codcoligada', chapa = '$chapa', codsecao = '$codsecao', pisparafgts = '$pisparafgts'

WHERE id = $ideditar ";
$query = mysqlquery($sql) or die(mysqlerror());

I could be wrong here, but I believe you need underscores in your mysql commands: mysqlquery should be mysql_query and mysqlfetcharray should be mysql_fetch_array etc…

Please be aware that the mysql_* extension is now deprecated as of the current version of PHP and will very likely be removed from the next 5.x version and will likely not be in PHP 6.x (when it eventually is released). You should migrate over to either the mysqli_* extension or to PDO. PDO is a better choice as it doesn’t tie you down so much to a particular database server software.

Once you have migrated you should use Prepared Statements to prevent SQL Injection attacks. Have a read of this article from the PHP manual, it shows how to use prepared statements with PDO and also explains the principle.

You’re not only missing the underscores, but the square brackets as well : $GET’cod’ should be $GET[‘cod’] etc.
Where did you get that code from? You’ll have to go through it and re-insert all missing characters.