I have this piece of code referred to a mysql table (novita) , whith the following fields:
id primary_key auto increment not null,
spot varchar(200),
titolo varhcar(200),
descrizione text;
Into a php page I have the following code that should need to update the values in fields for the selected record.
The update (aggiorna) procedre is not working and, damn, I cannot understand why !
I have the same code into another page and there it is working...
<?
$db=mysql_connect("www.website.com","user","pwd") or die("Errore durante la connessione al database");
mysql_select_db("dbname",$db);
if ($submit) {
$sql = "UPDATE novita SET spot='$spot',titolo='$titolo',descrizione='$descrizione' WHERE id='$id'";
$result = mysql_query($sql);
echo "<center><font face=\"Verdana\" size=\"2\"><B>Record updated!</b></font><center><br>";
}
?>
<form name="form1" method="post" action="<?php echo $PHP_SELF?>" enctype="multipart/form-data">
<?php
if ($id) {
$sql = "SELECT * FROM novita WHERE id='$id'";
$result = mysql_query($sql);
$myrow = mysql_fetch_array($result);
$id = $myrow["id"];
$spot = $myrow["spot"];
$titolo = $myrow["titolo"];
$descrizione = $myrow["descrizione"];
}
mysql_close();
?>
Thanks for any help about