POSTメソッドを使用する必要があります。
データベースに接続してコードを使用してデータを送信するPHPファイルを作成します。
例C#:
public void CreateUser(string username, string firstName, string lastName, string email, string phoneNumber)
{
WWWForm form = new WWWForm();
form.AddField("userNamePost", username);
form.AddField("firstNamePost", firstName);
form.AddField("lastNamePost", lastName);
form.AddField("phoneNumberPost", phoneNumber);
form.AddField("emailPost", email);
WWW www = new WWW("URL of the PHP file", form);
}
例PHP:
<?php
$servername = "localhost";
$server_username = "root";
$server_password = "";
$dbName = "databaseName";
$userName = $_POST['userNamePost'];
$firstName = $_POST['firstNamePost'];
$lastName = $_POST['lastNamePost'];
$phoneNumber = $_POST['phoneNumberPost'];
$emailAddress = $_POST['emailPost'];
$conn = new mysqli($servername, $server_username, $server_password, $dbName);
if(!$conn)
{
die("Connection Failed" .mysqli_connect_error());
}
else
{
echo "Connected";
}
$sql = "INSERT INTO table (all field names) VALUES ('".$userName."','".$firstName."','".$lastName."','".$phoneNumber."','".$emailAddress."')";
$result = mysqli_query($conn, $sql);
?>