PDA

View Full Version : PHP MySQL - Aggiornamento dati


negator136
14-10-2006, 20:16
ciao a tutti

per aggiornare un dato in una tabella mysql io solitamente uso questa stringa:

$query = "UPDATE table SET text = '$text_new' WHERE id = $id";

se volessi aggiornare pił campi della stessa riga contemporaneamente, come potrei fare? (ad esempio se volessi cambiare i campi text, text1 e text2)

qualcuno sa dirmi la sintassi della query?


GRAZIE MILLE

bianchins
15-10-2006, 10:29
Semplicemente aggiungi i campi da modificare con "," (virgola):
$query = "UPDATE table SET text = '$text_new', text1='$text1_new', text2='$text2_new' WHERE id = $id";

:)

negator136
15-10-2006, 11:21
Semplicemente aggiungi i campi da modificare con "," (virgola):
$query = "UPDATE table SET text = '$text_new', text1='$text1_new', text2='$text2_new' WHERE id = $id";

:)

grazie mille :)

dopo provo :D