I am using the code I have attached to insert a record into my Users table on my MYSQL database, the code works fine but it is inserting two records each time I create a user. I am not sure why as I am only inserting once in the code (or at-least I think so). Maybe someone has ran into a similar issue?
<?php
$username = $_GET["username"];
$password = $_GET["password"];
$con=mysqli_connect("localhost","pluginconnect","","UAPlugin");
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
mysqli_select_db($con,"UAPlugin");
$result = mysqli_query($con,"INSERT INTO UAPlugin_Login (username, password)
VALUES ('$username', '$password')");
$jsonResponse = array("UAPlugin" => array());
if(!$result)
{
die('Could not enter data: ' . mysql_error());
$jsonRow = array(
"success"=>"0",
"message"=>"Account Not Created");
array_push($jsonResponse["UAPlugin"],$jsonRow);
}
else
{
$jsonRow = array(
"success"=>"1",
"message"=>"Account Created");
array_push($jsonResponse["UAPlugin"],$jsonRow);
}
echo json_encode($jsonResponse);
?>