ciao a tutti, io sto tentando di inserire dei dati in una tabella del database tramite form, i dati che inseriscono devono corrispondere alla riga in cui c'è lo username di quello loggato, di modo da modificare i dati dell'utente...c'è un piccolo problema xò....ora vi mostro il codice
e quando schiaccio il pulsante x inviare i dati mi dice...codice:<?php require_once('Connections/Register.php'); ?> <?php session_start(); $squadra = $_SESSION['MM_Username']; if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $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; } } $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { $insertSQL = sprintf("INSERT INTO 'squadra' (Ultras, Stadio, Soprannome) VALUES (%s, %s, %s) WHERE 'Nome' = '$squadra' ", GetSQLValueString($_POST['Ultras'], "text"), GetSQLValueString($_POST['Stadio'], "text"), GetSQLValueString($_POST['Soprannome'], "text")); mysql_select_db($database_Register, $Register); $Result1 = mysql_query($insertSQL, $Register) or die(mysql_error()); } ?><style type="text/css"> <!-- body { background-color: #006600; } --> </style> <div align="center"> <form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1"> </p> </p> <table align="center" bgcolor="#006600"> <tr valign="baseline"> <td align="right" nowrap="nowrap" bgcolor="#006600">Ultras:</td> <td><input type="text" name="Ultras" value="" size="32" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right">Stadio:</td> <td><input type="text" name="Stadio" value="" size="32" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right">Soprannome:</td> <td><input type="text" name="Soprannome" value="" size="32" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right"> </td> <td><input name="" type="submit" onclick="<iframe>id="main" src="spogliatoio.php" frameborder="0" width="700" height="100%" marginheight="0" marginwidth="0" scrolling="yes"</iframe>" value="Modifica" /></td> </tr> </table> <input type="hidden" name="MM_insert" value="form1" /> </form> </p> </div>
codice:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''squadra' (Ultras, Stadio, Soprannome)

Rispondi quotando