Good day all
I have to pages (.php) to insert data into a MySql DBase. The problem is that it duplicates each new record, ie., it puts the same record in twice.
Here's the code: (the page that receives the form and inserts)
<?
$usernameWS=$_POST['wsUsername'];
$passwordWS=$_POST['wsPassword'];
$firstnameWS=$_POST['wsFirstName'];
$surnameWS=$_POST['wsSurname'];
$emailWS=$_POST['wsUserEmail'];
$mobileWS=$_POST['wsMobile'];
$joindateWS=$_POST['wsJoinDate'];
$hostname = "localhost";
$database = "wnidbase01";
$username = "wni1978";
$password = "infomite";
mysql_pconnect($hostname, $username, $password) or trigger_error(mysql_error(),E_USER_ERROR);
@mysql_select_db($database) or die( "Unable to select database");
$query = "INSERT INTO wsUsers VALUES ('','$usernameWS','$passwordWS','$firstnameWS','$surnameWS','$emailWS','$mobileWS','$joindateWS')";
mysql_query($query);
$result = @mysql_query($query) or die( "<b>Query Failed</b><br>\n".$query."<br>\n".mysql_errno().": ".mysql_error());
mysql_close();
?>
Any help would be most welcome
I have to pages (.php) to insert data into a MySql DBase. The problem is that it duplicates each new record, ie., it puts the same record in twice.
Here's the code: (the page that receives the form and inserts)
<?
$usernameWS=$_POST['wsUsername'];
$passwordWS=$_POST['wsPassword'];
$firstnameWS=$_POST['wsFirstName'];
$surnameWS=$_POST['wsSurname'];
$emailWS=$_POST['wsUserEmail'];
$mobileWS=$_POST['wsMobile'];
$joindateWS=$_POST['wsJoinDate'];
$hostname = "localhost";
$database = "wnidbase01";
$username = "wni1978";
$password = "infomite";
mysql_pconnect($hostname, $username, $password) or trigger_error(mysql_error(),E_USER_ERROR);
@mysql_select_db($database) or die( "Unable to select database");
$query = "INSERT INTO wsUsers VALUES ('','$usernameWS','$passwordWS','$firstnameWS','$surnameWS','$emailWS','$mobileWS','$joindateWS')";
mysql_query($query);
$result = @mysql_query($query) or die( "<b>Query Failed</b><br>\n".$query."<br>\n".mysql_errno().": ".mysql_error());
mysql_close();
?>
Any help would be most welcome