Hi all.
i have a problem with thi code. This code show and update a record of my database. When the page is loaded, it show my record. i update the record.(is ok, becouse i can see my database changed in window MSdos with MYSQL). But when i exit from this page and came back (i select this page ofrom another menu) this page not show the record updated (i repeat: the record is updated but the page not show this).
Problem:
The variable $uten not show the data update, but show the old data!!!?????
HELP ME PLEASE!!!!!
<?php session_start();
$idses=session_id();
require_once('Connections/iscritticon.php');
.
.
.
$editFormAction =$HTTP_SERVER_VARS['PHP_SELF'];
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING'];
}
mysql_select_db($database_iscritticon, $iscritticon);
//mysql_free_result($Result0);
$datiSQL = sprintf("SELECT * FROM info WHERE info.nickname = %s ;", GetSQLValueString($HTTP_SESSION_VARS["snickname"], "text"));
$uten=NULL;
$Result0 = mysql_query($datiSQL, $iscritticon) or die(mysql_error());
$uten = mysql_fetch_array($Result0);
if ((isset($HTTP_POST_VARS["MM_insert2"])) && ($HTTP_POST_VARS["MM_insert2"] == "form9"))
{
$insertSQL = sprintf("UPDATE info SET nickname= %s , nameboat = %s ,password= %s , country= %s, nambmainsail = %s ,email = %s WHERE info.nickname= %s ",
GetSQLValueString($HTTP_POST_VARS['nicknamet'], "text"),
GetSQLValueString($HTTP_POST_VARS['nomebarcat'], "text"),
GetSQLValueString($HTTP_POST_VARS['passwordt'], "text"),
GetSQLValueString($HTTP_POST_VARS['Nazionet'], "text"),
GetSQLValueString($HTTP_POST_VARS['numerorandat'], "int"),
GetSQLValueString($HTTP_POST_VARS['emailt'], "text"),
GetSQLValueString($HTTP_SESSION_VARS["snickname"], "text"));
mysql_select_db($database_iscritticon, $iscritticon);
$datiSQL = sprintf("SELECT * FROM info WHERE info.nickname = %s ;", GetSQLValueString($HTTP_SESSION_VARS["snickname"], "text"));
$uten=NULL;
$Result0 = mysql_query($datiSQL, $iscritticon) or die(mysql_error());
$uten = mysql_fetch_array($Result0);
$Result1 = mysql_query($insertSQL, $iscritticon) or die(mysql_error());
$insertGoTo = "PageItaModDatiok.php";
if (isset($HTTP_SERVER_VARS['QUERY_STRING']))
{
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];
}
header(sprintf("Location: %s&PHPSESSID=%s", $insertGoTo,$idses));
//}
}
$datiSQL = sprintf("SELECT * FROM info WHERE info.nickname = %s ;", GetSQLValueString($HTTP_SESSION_VARS["snickname"], "text"));
$uten=NULL;
$Result0 = mysql_query($datiSQL, $iscritticon) or die(mysql_error());
$uten = mysql_fetch_array($Result0);
if (isset($uten))
{ unset($uten);
$Result0 = mysql_query($datiSQL, $iscritticon) or die(mysql_error());
$uten =mysql_fetch_array($Result0);
}
echo $HTTP_SERVER_VARS['PHP_SELF'];
echo $HTTP_SERVER_VARS['QUERY_STRING'];
echo isset($uten);
?>
<html>
.
.
.
<form action="
<?php echo $editFormAction;?>
" method="POST" enctype="application/x-www-form-urlencoded" name="form9" target="_top" onSubmit=......>
.
.
.
.
<td width="54%"> <input name="nicknamet" type="text" id="nicknamet" value="[code=php]<?php echo $uten["nickname"]; ?>[/code]" size="20" maxlength="20">
</td>
</tr>
<tr>
<td><div align="right"> Nome Barca : </div></td>
<td> <input name="nomebarcat" type="text" id="nomebarcat" value="[code=php]<?php echo $uten["nameboat"]; ?>[/code]" size="20" maxlength="20">
</td>
</tr>
<tr>
<td><div align="right"> Password : </div></td>
<td> <input name="passwordt" type="password" id="passwordt" value="[code=php]<?php echo $uten["password"]; ?>[/code]" size="20" maxlength="10">
</td>
.
.
.
<div align="center"> <br>
<span class="menudestra">
<input name="inviat" type="submit" id="inviat" value="Invia">
<br>
<input type="hidden" name="MM_insert2" value="form9">
</span> </div>
</form>
.
.
</body>
</html>