ho trovato questo, ma ricevo errore se lo inserisco
forse qualche tag e' sbagliato o devo togliere qualcosa dal mio
Codice PHP:
if (isset($_POST['modifica']))
{
if ($query)
{
$fields = [];
foreach(['nome', 'performer_aka', 'website', 'career_status', 'birthday', 'died'] as $field)
if (isset($_POST[$field]))
$fields[] = $field . ' = "' . mysql_escape_string($_POST[$field]) . '"';
if (!empty($fields))
$query = mysql_query("UPDATE actor SET " . join(',', $fields) . " WHERE actor_id=" . (int)$actor_id);
}
}
questo e il mio codice
Codice PHP:
<?php
if (isset($_POST['modifica']))
{
//include "connetti.php";
//$query = mysql_select_db("xxx", $db);
if ($query)
{
$nome=$_POST['nome'];
$performer_aka=$_POST['performer_aka'];
$website=$_POST['website'];
$career_status=$_POST['career_status'];
$birthday=$_POST['birthday'];
$died=$_POST['died'];
$query=mysql_query("UPDATE actor SET
nome='".$_POST['nome']."',
performer_aka='".$_POST['performer_aka']."',
website='".$_POST['website']."',
career_status='".$_POST['career_status']."',
birthday='".$_POST['birthday']."',
died='".$_POST['died']."'
WHERE actor_id=". $actor_id);
if($query) echo "<h2>Congratulazioni! Dati inseriti.</h2>";
else echo "<h2>Attenzione! Dati non inseriti!</h2>";
} else echo "<h2>Errore! Database non selezionato.</h2>";
}
echo "SELECT * FROM actor WHERE actor_id=". $actor_id . "<br>";
print_r($_GET)
?>