-1
我對這個數據庫/服務器的東西很新,所以請耐心等待。我無法弄清楚爲什麼這些變量不會從Unity發佈到我的數據庫。不發佈到數據庫
- 我的數據庫連接信息是正確的,因爲其他職位正在工作。
這裏是我的php: - 我已經用非post變量替換了$ _POST變量,它們工作得很好!所以我對我的php代碼比較滿意。
<?php
$servername = "localhost";
$DBusername = "id*****_zingzingzingbah";
$DBpassword = "*******";
$DBName = "id430563_fitness2017";
$firstname = $_POST["firstnamePOST"];
$lastname = $_POST["lastnamePOST"];
$username = $_POST["usernamePOST"];
$email = $_POST["emailPOST"];
$password = $_POST["passwordPOST"];
//$firstname = "aaaa";
//$lastname = "aaaa";
//$username = "aaaa";
//$email = "aaaa";
//$password = "aaaa";
// Make Connection
$conn = new mysqli($servername,$DBusername, $DBpassword, $DBName);
// Check Connection
if (!$conn) {
die ("Connection Failed. ". mysqli_connect_error());
} else { echo "Connection Success" ; // display some text or info on the screen }
$sql = "INSERT INTO user_info (firstname, lastname, username, email, password) VALUES('".$firstname."','".$lastname."','".$username."','".$email."','".$password."')";
$result = mysqli_query($conn, $sql);
if(!$result) {
echo "there was an error creating user specific table";
} else {
echo "Everything OK2";
}
>
下面參見Unity C#代碼... - ?我有空兩個CREATEUSER功能,使虛空之一,可以從統一訪問...我有麻煩訪問IEnumerator的功能,否則。 - 代碼卡住後insertUserInfo = new WWW (InsertUserInfoURL,form);
- 收益率沒有返回。
public void CreateUser(string inputFirstname, string inputLastname, string inputUsername,string inputEmail,string inputPassword){
StartCoroutine (CreateUser2 (inputFirstname,inputLastname,inputUsername,inputEmail,inputPassword));
}
private IEnumerator CreateUser2(string inputFirstname, string inputLastname, string inputUsername,string inputEmail,string inputPassword){
WWWForm form = new WWWForm();
inputFirstname = "bbb";
inputLastname = "bbb";
inputUsername = "bbb";
inputEmail = "bbb";
inputPassword = "bbb";
form.AddField ("firstnamePOST", inputFirstname);
form.AddField ("lastnamePOST", inputLastname);
form.AddField ("usernamePOST", inputUsername);
form.AddField ("emailPOST", inputEmail);
form.AddField ("passwordPOST", inputPassword);
print("getting here ok");
insertUserInfo = new WWW (InsertUserInfoURL,form);
yield return insertUserInfo;
print("why aren't you getting here");
- 我敢肯定的URL是正確的(在試驗基地無POST變量)
- 我敢肯定,DB信息是正確的(在試驗基地無POST變量)
我敢肯定的SQL代碼是正確的(在試驗基地無POST變量)
我肯定調用CREATEUSER功能(兩者)
想知道關於故障排除這個東西任何提示,因爲我覺得我在黑暗中
感謝傢伙正在摸索!
您是否嘗試過使用HTTP調試器,如Fiddler2? –
*「我對我的php代碼比較滿意」* - 如果您使用sql注入,您將不會受到影響;使用準備好的聲明。更不用說使用純文本密碼。你沒有生活或與此相處,是嗎? –
散列你的用戶密碼..這在哪裏失敗? 'POST'值不會讓它到PHP? – chris85