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 APProjects · Mar 10, 2014 at 01:50 PM · wwwdatabasemysqlphpreading data

Unity - MySQL data loss

Hello!

I made a simple game with a leaderboard and achievements system. I am using php and MySQL for storing the data. The score saving works flawlessly, but the achievement system is glitchy. In my MySQL database, I have only one int type field for all the achievements. The concept is simple, I convert the array of achievements to a decimal number from the boolean values. When it works, it works perfectly, I don't think, the problem is with this. When it reads out from the database (using simple WWW forms), a static variable gets the data.

Old achievements can't be get again. However, sometimes in the middle of the game, it forgets I already have one. Last time I tested I got an achievement that I already had, I knew, something will be wrong, I looked at the database, and there was a 0 at my name in the achievements field. I was playing it in webplayer and I searched for the log file. I saw, that when I got the achievement again, it sent the right value toward the php (the game saves the achievement data when you get one, not at the end of the game). So it wasn't 0 but 191 (10111111) which means first 6 and 8th achievemnt was completed. It's perfectly all right, but it sent a 0 into my database (or cleared the data, the field's default value is 0).

Anyway, I restart the game by reloading scene, but it seems like, the problem comes from somewhere else.

I don't expect an exact answer based on what I wrote above as I didn't provide source code (there are multiple scripts that do the job the), but what do you think, where should I search for the problem? I am totally confused right now.

Comment
Add comment · Show 1
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 APProjects · Mar 12, 2014 at 01:58 PM 0
Share

Still didn't find the problem. I constantly log and look at the variables when it saves and do other things. Everything looks all right! WWW.error doesn't give an error, I log the full URL with the parameters. It looks flawless.

*http://mydomain/supermax_db/ach_save.php?name=TestUser∾h=19&hash=a6625be8c53d8a79410d955c3db72ce8*

There it is, ach=19 which means it should write 19 into the database which mean, 1st, 2nd and 5th achievements are done. Sometimes it works, sometimes I get a 0 in my database.

I am at 000webhost, but I don't think it is the host's problem as from more than 400 score submission 400 worked well. It's flawless.

I also tried to do it at the end of the game, not at when a player unlocks an achievement. Same bad result (sometimes).

Now I guess it is related it is related to the game restarting. I was checking my database in php$$anonymous$$ySQL everytime I unlocked an achievement, the new data was always there. However, sometimes, when I restarted the game after a "Game Over", I lost it (it reloads the current level anyway). The PostAchievements coroutine runs only when a player get a new achievement, so I am still confused, it's like it runs when I restart it and send a 0 to the database... sometimes.

I am less confused now, but still. I don't know, what to do.

0 Replies

· Add your reply
  • Sort: 

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

20 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

Related Questions

www php send data to mysql 2 Answers

Upload audio file into mysql database 0 Answers

How to get different variables from PHP page ? (example included)... 1 Answer

Android Mysql Database online 3 Answers

Is it possible to let a variable in c# to get the value of a variable in php. 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