Ho realizzato una tabella per modificare i dati in un database mysql ma quando invio i dati mi dice errore.
questa è la pagina da dove vengono inviati i dati
Codice PHP:
<?php require_once('Connections/orario.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($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;
}
}
mysql_select_db($database_orario, $orario);
$query_classe1a = "SELECT * FROM `1a`";
$classe1a = mysql_query($query_classe1a, $orario) or die(mysql_error());
$row_classe1a = mysql_fetch_assoc($classe1a);
$totalRows_classe1a = mysql_num_rows($classe1a);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento senza titolo</title>
</head>
<body>
<form action="inviodati.php" method="post">
<table width="100%" border="1">
<tr>
<td>ID</td>
<td>Giorno</td>
<td>1ora</td>
<td>2ora</td>
<td>3ora</td>
<td>4ora</td>
<td>5ora</td>
<td></td>
</tr>
<tr>
<td><label for="testo_id"></label>
<input value="<?php echo $row_classe1a['ID']; ?>" type="text" name="testo_id" id="testo_id" /></td>
<td><label for="testo_giorno"></label>
<input value="<?php echo $row_classe1a['giorno']; ?>" type="text" name="testo_giorno" id="testo_giorno" /></td>
<td><label for="testo_1ora"></label>
<input value="<?php echo $row_classe1a['mat1ora']; ?>" type="text" name="testo_1ora" id="testo_1ora" /></td>
<td><label for="testo_2ora"></label>
<input value="<?php echo $row_classe1a['mat2ora']; ?>" type="text" name="testo_2ora" id="testo_2ora" /></td>
<td><label for="testo_3ora"></label>
<input value="<?php echo $row_classe1a['mat3ora']; ?>" type="text" name="testo_3ora" id="testo_3ora" /></td>
<td><label for="testo_4ora"></label>
<input value="<?php echo $row_classe1a['mat4ora']; ?>" type="text" name="testo_4ora" id="testo_4ora" /></td>
<td><label for="testo_5ora"></label>
<input value="<?php echo $row_classe1a['mat5ora']; ?>" type="text" name="testo_5ora" id="testo_5ora" /></td>
<td><input type="submit" name="puls" id="puls" value="Invia" /></td>
</tr>
</table>
</form>
</p>
</body>
</html>
<?php
mysql_free_result($classe1a);
?>
e questa è la pagina per l'ivio
Codice PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento senza titolo</title>
</head>
<?php
include "Connections/orario.php";
$ID =$_POST["testo_id"];
$giorno =$_POST["testo_giorno"];
$mat1ora =$_POST["testo_1ora"];
$mat2ora =$_POST["testo_2ora"];
$mat3ora =$_POST["testo_3ora"];
$mat4ora =$_POST["testo_4ora"];
$mat5ora =$_POST["testo_5ora"];
echo "$cognome";
echo "$nome";
echo "$e_mail";
echo "$societ";
echo "$gruppo";
echo "$user";
echo "$password";
$query = "INSERT INTO 1a (`ID`, `giorno`, `mat1ora`, `mat2ora`, `mat3ora`, `mat4ora`, `mat5ora`) VALUES ('$testo_id','$testo_giorno','$testo_1ora','$testo_2ora','$testo_3ora','$testo_4ora','$testo_5ora')";
echo "$query";
echo "$conn";
$result = mysql_query($query,$conn);
echo "$result";
if ($result == FALSE)
{
echo ("inserimento nn riuscito");
}
else
{
echo ("inserimento riuscito");
}
?>
<body>
</body>
</html>