Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 missypooh · Mar 25, 2012 at 02:53 PM · databasemysql

insert values into mySQL databases

I would like to insert data into mySQL. How can i go about doing this?? I have read up all about php/WWW form but i find it hard to do one. Any kind soul willing to providing some sample code snippet??

Comment
Add comment · Show 4
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 farooqaaa · Mar 25, 2012 at 04:00 PM 0
Share

Where is the $$anonymous$$ySQL database located?

avatar image missypooh · Mar 25, 2012 at 04:10 PM 0
Share

what you mean by where is mySQL database located? It is located in the same project as the games. I created a folder name plugins to store all the dlls that is needed for mySQL.. I am creating a standalone games.

avatar image farooqaaa · Mar 25, 2012 at 04:13 PM 0
Share

Are you talking about $$anonymous$$ySQL or SQLite? You can't have $$anonymous$$ySQL packed with your game.

avatar image missypooh · Mar 25, 2012 at 04:18 PM 0
Share

Sorry i am confused. I am using mySQL. I am using mySQL workbench to edit, create all database instance. :) ACtually initially i am using sqlite, but when i run using .exe file, it doesn't update my database at all. thatwise change to mySQL

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by dkNinja · Apr 13, 2012 at 04:26 AM

I have used MySQL and SQLite with Unity3d. From my experience, I would highly suggest using SQLite unless you have a feature in MySQL that isn't available in SQLite. That said, in order to have SQLite working in an .exe file, you have to include sqlite3.dll file in the plugins directory during build time. You can download the dll for your system on the SQLite website.

If you still want to use MySQL, you can follow the tutorial at http://www.freewebmasterhelp.com/tutorials/phpmysql

Comment
Add comment · 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
0

Answer by Thewhiteaura · Jun 01, 2015 at 09:05 PM

sorry to post to an old question, but to anybody coming across this, and to the original poster as well (should they re-read this), before you indulge in that website (may be good for general knowledge) I highly recommend reading through this article as well if you are going to be using MySQL.

http://www.phpro.org/tutorials/Introduction-to-PHP-PDO.html

and another site for PDO

http://wiki.hashphp.org/PDO_Tutorial_for_MySQL_Developers

Comment
Add comment · 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
0

Answer by ash_05 · Apr 02, 2016 at 05:27 AM

first create a database and create a php code(register.php) and place it in you wamp

 <?php
 $username=$_REQUEST['username'];
 $password=$_REQUEST['password'];
  $database = mysql_connect('localhost', 'root', 'amma') or die('Failed to connect: ' . mysql_error());
         mysql_select_db('gameuser') or die('Failed to access database');
         $query="INSERT INTO users(username,password) VALUES('$username','$password');";
         $result=mysql_query($query);
         echo "registered";
         
 ?>

unity code

     string getscoreCode="http://192.168.173.243/GameDatabase/register.php";
     
     
     public Rect windowRect0 = new Rect(20,20,500,300);
     public Rect windowRect1 = new Rect(20,350,500,0);
     public Rect windowRect2 = new Rect(20,450,500,0);
     
     public static string username="";
     public static string password="";
     public static string result="";
     public string scoreboard="";
     public string highscore="";
     void Start () {
         
     }
     
     // Update is called once per frame
     void Update () {
         
     }
     void OnGUI() {
         windowRect0 = GUI.Window(0, windowRect0, LeaderBoard, "SCORE ENTRY BOARD");
         if(GUI.Button (new Rect (400, 450, 150, 50), "add"))
         {
             Application.LoadLevel("ScoreBoardDisplay");
         }
     }
     void LeaderBoard(int windowID) {
         GUI.Label (new Rect (140, 40, 150, 100), "Enter the Players name");
         username = GUI.TextField (new Rect (25, 60, 375, 30), username);
         GUI.Label (new Rect (140, 92, 150, 100), "Enter the password");
         password= GUI.TextField(new Rect (25, 115, 375, 30), password);
         if (GUI.Button (new Rect (150, 160, 175, 50), "Save the Score"))
             StartCoroutine(handleEnterScore(username,password));//
         GUI.Label (new Rect (55, 222, 250, 100),result);
 
 
         
     }
     IEnumerator  handleEnterScore(string user,string pass)
     {
         
         string register_url = getscoreCode + "?username=" + user + "&password=" + pass;
         WWW entereddata = new WWW (register_url);
         yield return entereddata;
         if(entereddata.text == "registered")
         {
             result=" correctly";
         }
         else{
             result="incorrectly";
         }
         username = "";
         password= "";
     }
     
 }
     
 



Comment
Add comment · 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

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

7 People are following this question.

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

Related Questions

Database connection on PhPMyAdmin 1 Answer

when i build my application i get ,some dll error 2 Answers

Inventory with a Database 0 Answers

Problem with storing information such as Money amount in mySQL database? 1 Answer

Upload audio file into mysql database 0 Answers


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