- Home
- Categorie
- Coding e Sistemistica
- Coding
- update!!
-
update!!
ciao ragazzi vengo subito al nocciolo indicandovi tutto tutto^_^
[php]
<?session_start ();
include "../config.inc.php";
$ID=$_POST["NUM"];
$CHI=$_POST["CHIS"];
$IO=$_POST["IOS"];
//$DATA_POSTA = date ("d/m/Y H:i:s");
//formattazione data
// setto data e ora in base alla linga locale
setlocale (LC_TIME,"it_IT");
// metto data e ora in un array
$DATAORIG = time();
$date_time_array = getdate($DATAORIG);
$hours = $date_time_array['hours'];
$minutes = $date_time_array['minutes'];
$seconds = $date_time_array['seconds'];
$month = $date_time_array['mon'];
$day = $date_time_array['mday'];
$year = $date_time_array['year'];
// aggiungo 7 ore all'orario del server per avere l'ora corretta in Iralia
$DATAORIG = mktime($hours,$minutes,$seconds);
//fine formattazione data
$DATA_POSTA = strftime('%H : %M - %A %d %B %Y',$DATAORIG);
$sqlonline = "SELECT * FROM USERS WHERE USERNAME = '$CHI'";
$contonline = mysql_query($sqlonline) or die(mysql_error());
$numonline = mysql_num_rows($contonline);
if ($numonline == '0'){
print "<script language='javascript'>alert('L'utente è inesistente.');</script>";
}
else if ($numonline == '1')
{
$nome= "UPDATE BORSA SET PROPRIETARIO = $CHI WHERE ID='$ID'";
mysql_query("$nome") or die(mysql_error());
$sql01= "INSERT INTO
POSTA
( ID_POSTA , FROM_POSTA , TO_POSTA , OBJ_POSTA , MSG_POSTA , DATA_POSTA , NEW_POSTA )VALUES (
'', '$IO', '$IO', 'Conferma Trasferimento', '$IO ha consegnato $B_OBJ a $CHI con successo!', '$DATA_POSTA', '1'
)";
mysql_query("$sql01") or die(TRE);
$sql02= "INSERT INTO
POSTA
( ID_POSTA , FROM_POSTA , TO_POSTA , OBJ_POSTA , MSG_POSTA , DATA_POSTA , NEW_POSTA )VALUES (
'', '$IO', '$CHI', 'Conferma Trasferimento', '$IO ha consegnato $B_OBJ a $CHI', '$DATA_POSTA', '1'
)";
mysql_query("$sql02") or die(QUATTRO);
print "<script language='javascript'>alert('Trasferimento effettuato con successo.');</script>";
}
@mysql_close ($connessione);
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" href="../stile.css" type="text/css">
<title>Documento senza titolo</title>
</head>
<body>
</body>
</html>
[/php]
questa è la pagina che quando fà l'update mi dà errore.... mi dice
Unknown column 'qui mette il nome derivato da $CHI' in 'field list'
perchè??
thx^^
-
controlla bene che i campi inseriti nella tabella del database e i valori inseirti nella query.
controllali uno per uno
deve esserci qualche errore lì
-
il problema è che dice che non esiste la colonna nella lista e si riferisce a $CHI non ho mai avuto problemi con l'up.... idee
-
Prova a cambiare questa riga:
$nome= "UPDATE BORSA SET PROPRIETARIO = $CHI WHERE ID='$ID'";
così:
$nome= "UPDATE BORSA SET PROPRIETARIO = '$CHI' WHERE ID='$ID'";
-
grazie margerite^^ se vedi un altro post^^ ora lo faccio ho una domanda alla quale non so rispondere^_^
ps('') del cacchio