usavo questo codice per aggiornare i dati di una tabella....e funzionava.... ora lo applico a una nuova tabella modificando i riferimenti.... e non aggiorna più....
il codice è questo
<?php
$hostname_musso = "localhost";
$database_musso = "cleabble01";
$username_musso = "cleabble01";
$password_musso = "N8pbRaWe";
$musso = mysql_pconnect($hostname_musso, $username_musso, $password_musso) or die(mysql_error());
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
if ((isset($HTTP_POST_VARS["MM_update"])) && ($HTTP_POST_VARS["MM_update"] == "form1")) {
$updateSQL = sprintf("UPDATE oroscopo SET segno=%s, oroscopo=%s WHERE ID=%s",
GetSQLValueString($HTTP_POST_VARS['segno'], "text"),
GetSQLValueString($HTTP_POST_VARS['oroscopo'], "text"),
GetSQLValueString($HTTP_POST_VARS['ID'], "int"));
mysql_select_db($database_musso, $musso);
$Result1 = mysql_query($updateSQL, $musso) or die(mysql_error());
}
mysql_select_db($database_musso, $musso);
$query_Recordset1 = "SELECT * FROM oroscopo WHERE ID = '".$id."'";
$Recordset1 = mysql_query($query_Recordset1, $musso) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
?>
<html>
<head>
<title>Modifica record news</title>
<style type="text/css">
<!--
A{ COLOR: #3366aa; TEXT-DECORATION: none }
A:hover { COLOR: #f83c48; TEXT-DECORATION: none }
-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#E6FFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<div align="center">
</p>
</p>
<table width="492" border="0" align="center" cellpadding="0" cellspacing="0">
<td width="9%"></td>
<td width="88%" bgcolor="#6699CC"><div align="center"> <font color="#FFFFFF" size="3" face="Verdana, Arial, Helvetica, sans-serif">Modifica
oroscopo </font></div></td>
<td width="3%"></td>
</table>
</div>
<table align="center">
<form method="post" name="form1" action="<?php echo $editFormAction; ?>">
<tr valign="baseline">
<td nowrap align="right" valign="top"><h4><font face="Verdana, Arial, Helvetica, sans-serif">segno</font>:</h4></td>
<td><input type="text" name="segno" value="<?php echo $row_Recordset1['segno']; ?>" size="70"></td>
</tr>
<tr valign="baseline">
<td height="60" align="right" valign="top" nowrap><h4><font face="Verdana, Arial, Helvetica, sans-serif">oroscopo</font>:</h4></td>
<td><input type="text" name="oroscopo" value="<?php echo $row_Recordset1['oroscopo']; ?>" size="400"></td>
</tr>
<tr><td height="10"> </td><td> </td></tr>
<input type="hidden" name="id" value="<?php echo $row_Recordset1['ID']; ?>" size="32">
</table>
<input type="hidden" name="MM_update" value="form1">
<input type="hidden" name="id" value="<?php echo $row_Recordset1['ID']; ?>">
</table>
<div align="center">
<input type="submit" value="Conferma modifiche">
</p>
Torna alla pagina di scelta
</p>
</div>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>
Grazie a chi vorrà aiutarmi