Corona DB Usage

Hi again, im back with more questions  :huh:  :stuck_out_tongue:
 
* Its possible to work with online DB? 
 
–> I mean basic usage, the plan its online DB example like this:

------------------------------------------------------------------------------------------------ Student            |       10:00          |        11:00      |        12:00     | ------------------------------------------------------------------------------------------------ Bob                            x                           x                     x John                          -                            -                      x

Something like a table with some students, with hours and read from app data in db (if its clear) because its new day, create new table and from the app u can add if the guy came to class or he is afk LOL :smiley:

  • I saw very old posts like 2012-2013, and some of those links are currently down so i cant read those informations.

  • What DB or service you recommend me for that task?

I saw some options but seems to be hard implentation or just for high size files example:

  • Google Cloud

  • Amazon Web

  • Parse

Thanks again,

I created a google spreadsheet, with some users and pws (just testing)

1aabf07320.png

I created a login menu:

c71c50dd8a.png

CODE:

local function iniciarboto( self, event ) if ( usuarisessio.text == "" or contrasenyasessio.text == "" ) then local alert = native.showAlert( "Els camps estan buits!", "Has d'omplir tots els camps.", { "D'acord" } ) return true else composer.gotoScene( "primera" ) return false end end local title = display.newText( "Iniciar sessió", display.contentCenterX, 16, "Lifecraft.ttf", 32 ) title:setFillColor( 1, 0.88, 0.3 ) local usuari = display.newText( "Usuari", 200, 230, "Lifecraft.ttf", 24 ) usuari.x = 105 usuari.y = 90 local pw = display.newText( "Contrasenya", 200, 230, "Lifecraft.ttf", 24 ) pw.x = 130 pw.y = 160 local iniciar = display.newImageRect( "iniciaricono.png", 200, 40 ) iniciar.x = display.contentCenterX iniciar.y = 230 iniciar.tap = iniciarboto iniciar:addEventListener( "tap" ) usuarisessio = native.newTextField( 320, 94, 180, 30 ) usuarisessio.placeholder = "Escriu l'usuari" contrasenyasessio = native.newTextField( 320, 159, 180, 30 ) contrasenyasessio.placeholder = "Escriu la contrasenya" contrasenyasessio.isSecure = true

ATM this code should if fields are empty show warning fileds cant be empty (working), but if i write something asd and pw asd, it should go to next composer screen, btw i get this error:

ccf8e82c41.png

EDIT THIS ERROR SOLVED, NOW GOES TO THE NEXT COMPOSER.

Now goes to next screen but throws me new error, im having some troubles to remove textfields, i did this:

local function iniciarboto( self, event ) if ( usuarisessio.text == "" or contrasenyasessio.text == "" ) then local alert = native.showAlert( "Els camps estan buits!", "Has d'omplir tots els camps.", { "D'acord" } ) return true else composer.gotoScene( "primera" ) usuarisessio:removeSelf() usuarisessio = nil contrasenyasessio:removeSelf() contrasenyasessio = nil return false end end local iniciar = display.newImageRect( "iniciaricono.png", 200, 40 ) iniciar.x = display.contentCenterX iniciar.y = 230 iniciar.tap = iniciarboto iniciar:addEventListener( "tap" ) usuarisessio = native.newTextField( 320, 94, 180, 30 ) usuarisessio.placeholder = "Escriu l'usuari" contrasenyasessio = native.newTextField( 320, 159, 180, 30 ) contrasenyasessio.placeholder = "Escriu la contrasenya" contrasenyasessio.isSecure = true

64d0bb2940.png


I wish to connect with spreadsheet something like:

local function iniciarboto( self, event ) if ( usuarisessio.text == "" or contrasenyasessio.text == "" ) then local alert = native.showAlert( "Els camps estan buits!", "Has d'omplir tots els camps.", { "D'acord" } ) return true else if ( usuarisessio.text == "SOMESPREADSHEETLINK C:3 ID CELL" and contrasenyasessio.text == "SOMESPREADSHEETLINK D:3 PW CELL" ) then composer.gotoScene( "primera" ) return false end end

https://coronalabs.com/blog/2012/11/20/how-to-download-json-data-from-mysql-using-corona-sdk/

Would it work for you?

so far i have created many business Apps and games that use database … whether local (sqlLite) or hosted (SQL, MySQL, ORACLE)

this social app is one of them serving 10,000 active users, and over 50,000 messages are sent everyday through this App

you need to do the following:

  1. design your database and tables on your host’s portal, you need to be familiar with that, and build proper database indexes on large tables
  2. Create Web services using any technology (.NET or PHP), those web services will be configured to talk to your database, and return json formatted data, you need to know how to design your web services to be of high peorformance
  3. write your code to call the web services for data insertion, deletion, update, or retrieval using network.request command

depending on your webservice design, you can have your SQL statements thrown inside your Lua code, or inside your webservice itself, either way you need to be familiar with SQL Language to query your data

it sounds a little bit not easy, but once you create your first project, it is very easy and straight forward

i can provide you with further help if you are still interested

Side note, the way you are storing passwords is not secure. Consider hashing them(with a salt if you want it to be safer).

I created a google spreadsheet, with some users and pws (just testing)

1aabf07320.png

I created a login menu:

c71c50dd8a.png

CODE:

local function iniciarboto( self, event ) if ( usuarisessio.text == "" or contrasenyasessio.text == "" ) then local alert = native.showAlert( "Els camps estan buits!", "Has d'omplir tots els camps.", { "D'acord" } ) return true else composer.gotoScene( "primera" ) return false end end local title = display.newText( "Iniciar sessió", display.contentCenterX, 16, "Lifecraft.ttf", 32 ) title:setFillColor( 1, 0.88, 0.3 ) local usuari = display.newText( "Usuari", 200, 230, "Lifecraft.ttf", 24 ) usuari.x = 105 usuari.y = 90 local pw = display.newText( "Contrasenya", 200, 230, "Lifecraft.ttf", 24 ) pw.x = 130 pw.y = 160 local iniciar = display.newImageRect( "iniciaricono.png", 200, 40 ) iniciar.x = display.contentCenterX iniciar.y = 230 iniciar.tap = iniciarboto iniciar:addEventListener( "tap" ) usuarisessio = native.newTextField( 320, 94, 180, 30 ) usuarisessio.placeholder = "Escriu l'usuari" contrasenyasessio = native.newTextField( 320, 159, 180, 30 ) contrasenyasessio.placeholder = "Escriu la contrasenya" contrasenyasessio.isSecure = true

ATM this code should if fields are empty show warning fileds cant be empty (working), but if i write something asd and pw asd, it should go to next composer screen, btw i get this error:

ccf8e82c41.png

EDIT THIS ERROR SOLVED, NOW GOES TO THE NEXT COMPOSER.

Now goes to next screen but throws me new error, im having some troubles to remove textfields, i did this:

local function iniciarboto( self, event ) if ( usuarisessio.text == "" or contrasenyasessio.text == "" ) then local alert = native.showAlert( "Els camps estan buits!", "Has d'omplir tots els camps.", { "D'acord" } ) return true else composer.gotoScene( "primera" ) usuarisessio:removeSelf() usuarisessio = nil contrasenyasessio:removeSelf() contrasenyasessio = nil return false end end local iniciar = display.newImageRect( "iniciaricono.png", 200, 40 ) iniciar.x = display.contentCenterX iniciar.y = 230 iniciar.tap = iniciarboto iniciar:addEventListener( "tap" ) usuarisessio = native.newTextField( 320, 94, 180, 30 ) usuarisessio.placeholder = "Escriu l'usuari" contrasenyasessio = native.newTextField( 320, 159, 180, 30 ) contrasenyasessio.placeholder = "Escriu la contrasenya" contrasenyasessio.isSecure = true

64d0bb2940.png


I wish to connect with spreadsheet something like:

local function iniciarboto( self, event ) if ( usuarisessio.text == "" or contrasenyasessio.text == "" ) then local alert = native.showAlert( "Els camps estan buits!", "Has d'omplir tots els camps.", { "D'acord" } ) return true else if ( usuarisessio.text == "SOMESPREADSHEETLINK C:3 ID CELL" and contrasenyasessio.text == "SOMESPREADSHEETLINK D:3 PW CELL" ) then composer.gotoScene( "primera" ) return false end end

https://coronalabs.com/blog/2012/11/20/how-to-download-json-data-from-mysql-using-corona-sdk/

Would it work for you?

so far i have created many business Apps and games that use database … whether local (sqlLite) or hosted (SQL, MySQL, ORACLE)

this social app is one of them serving 10,000 active users, and over 50,000 messages are sent everyday through this App

you need to do the following:

  1. design your database and tables on your host’s portal, you need to be familiar with that, and build proper database indexes on large tables
  2. Create Web services using any technology (.NET or PHP), those web services will be configured to talk to your database, and return json formatted data, you need to know how to design your web services to be of high peorformance
  3. write your code to call the web services for data insertion, deletion, update, or retrieval using network.request command

depending on your webservice design, you can have your SQL statements thrown inside your Lua code, or inside your webservice itself, either way you need to be familiar with SQL Language to query your data

it sounds a little bit not easy, but once you create your first project, it is very easy and straight forward

i can provide you with further help if you are still interested

Side note, the way you are storing passwords is not secure. Consider hashing them(with a salt if you want it to be safer).