RE: MySQL Results Not Being Committed To Database

From: Date: Sat, 03 Jul 2004 19:25:04 +0000
Subject: RE: MySQL Results Not Being Committed To Database
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-189639@lists.php.net to get a copy of this message
> Torsten > > I managed to work through it and this is the code: > > $NewUserID= $_POST['TXT_UserID']; > $NewUserPassword= $_POST['TXT_UserPassword']; > $NewUserComments= $_POST['TXT_Comments']; > $NewUserFurtherComments=$_POST['TXT_FurtherComments']; > $sql = "INSERT INTO RegisteredMembers > (UserID,UserPassword,Comments,FurtherComments) > > > VALUES('".$NewUserID."','".$NewUserPassword."','".$NewUserComments > ."','".$Ne > wUserFurtherComments."')"; > $query = mysql_query($sql); > $mysql_result = mysql_query ($sql, $Connection) or die ("Invalid > Query - " . mysql_error()); > > echo "<pre>Username:\t\t$NewUserID</pre><br>"; > echo "<pre>Password:\t\t$NewUserPassword</pre><br>"; > echo "<pre>Comments:\t\t$NewUserComments</pre><br>"; > echo "<pre>Further Comments:\t$NewUserFurtherComments</pre>"; > > mysql_close ($Connection); > > However. I still get an error although the input is actually > commited to the > database: > > Invalid Query - Duplicate entry 'SherylJo' for key 1 > > I don't follow this because although I have set that particular > field up as > a primary key this value is not duplicated... Strange. Hi Michael, please always anser to the list (Answer All). Could you post your table structure? Regards, Torsten

« previous php.general (#189639) next »