I just want to know how I can get a value from an online database to my game.. for example when the database value is 1 than I want that the screen is green when it is 2 the screen should be red..
Develop games in your browser. Powerful, performant & highly capable.
You need to use the AJAX plugin to request a web page and have the webpage output the value you want, based on any parameters you supply.
I used AJAX, php, and mySQL to read/write to a db within HTML5/C2.
Here is the tutorial that got me started: https://www.scirra.com/tutorials/346/on ... -php-mysql