Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by 842895893 · Jul 10, 2017 at 01:05 AM · phpsql

I can't get the value from unity to PHP

I can't get the value from unity to PHP. It always prints "No information was collected" in unity no matter what I did. It worked perfectly when I used $sql = "INSERT INTO Acount(AcountID,Date) VALUES('$AccountID','$Date')"; in other php file. The PHP file is uploaded to a web host already. Scripts are posted in the comment.

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image 842895893 · Jul 10, 2017 at 01:06 AM 0
Share
 <?php
     $servername = "localhost";
     $server_username ="id167852_guofengting";
     $password = "1744179856";
     $dbName = "id167852_gloryseeker_database";
     
     $InputID = $_POST["AccountIDpost"];
     
     //$$anonymous$$ake Connection
     
     $conn = new mysqli($servername, $server_username, $password, $dbName);
     
     if(!$conn){
     
         die("Connection Failed. ".mysqli_connect_error());
         
     }
     else echo("");
     
     $sql = "SELECT * FRO$$anonymous$$ Acount WHERE AcountID = '$InputID'";
     $result = mysqli_query($conn,$sql);
         
     if(mysqli_num_rows($result)>0){
     
         echo "Have A Existed Account";
     
     }else{
             
         echo("No information was collected");
     
     }
     
     
     ?>
avatar image 842895893 · Jul 10, 2017 at 01:08 AM 0
Share
 IEnumerator CheckExistAccount(string input){
 
         string data = "";
 
         WWWForm form = new WWWForm ();
         form.AddField ("AccountIDpost",input);
         WWW www = new WWW(checkAccountURL);
         yield return www;
 
         if (www.error == null) {
 
 
             if (www.isDone) {
 
                 data = www.text; 
                 Debug.Log ("ExitsAccount:" + data);
 
 
             } else {
 
                 Debug.Log ("Error!!! ");
 
             }
 
 
         } else {
 
             Debug.Log ("Error!!! ");
 
         }
 
         if (data == "No information was collected") {
 
             Debug.Log ("false ");
             CreateUserProccesser ();
 
         } else if(data =="Have A Existed Account"){
             
             Debug.Log ("true ");
 
         }
         else if(data == "Null"){
 
             Debug.Log ("Null ");
 
         }
 
 
     }

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by Bunny83 · Jul 10, 2017 at 02:20 AM

You created a WWWForm but you never used it anywhere. You have to pass it to the WWW constructor:

 // [ ... ]
 WWWForm form = new WWWForm ();
 form.AddField ("AccountIDpost",input);
 WWW www = new WWW(checkAccountURL, form);
 yield return www;
 // [ ... ]
Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image 842895893 · Jul 10, 2017 at 12:34 PM 0
Share
 string createUserURL = "https:
 string checkAccountURL = "https:


I have it. The problem is the php file doesn't want to accept my input somehow

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

68 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

My code to php -> sql in PC good, in Android not work. plese fast 1 Answer

Unity PHP/SQL table creation adds strange characters to table name 2 Answers

Why is my PHP echo returning entire PHP file after WWW request? 1 Answer

Getting Specific mySql Row by searching table with a name 0 Answers

Scoreboard/Leaderboard Script for both server and client? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges