[SOLVED] Connect to a mysql database online

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
Nal
Prole
Posts: 5
Joined: Mon Apr 08, 2013 4:11 pm
Location: Northern France
Contact:

[SOLVED] Connect to a mysql database online

Post by Nal »

Hi everyone !

I am doing a project for school, the main purpose of the project is to create a game and save scores on an online database so we can access it throught our website.

We have the game, website and mysql database, the problem is that I have no clue how to connect to my database from love. I found this topic : viewtopic.php?f=4&t=11891&p=71350&hilit=mysql#p71350.

From what I understood I need sth like a mysql.dll . I found one on internet but to be honest I doubt it is something really official... anyway, I just would like to know which files I need before starting to code (any .dll or other), and inside my code how can I start the connection ?
I found something like :

Code: Select all

-- load the MySQL dll
loadlib ("mysql.dll", "luaopen_luasqlmysql") ()

-- create environment object
env = assert (luasql.mysql())

-- connect to data source
con = assert (env:connect ("databasename", "username", "password", "servername"))
Is it correct ?

Thank you for your help :) .
Last edited by Nal on Wed Apr 10, 2013 4:15 pm, edited 1 time in total.
Men should be able to handle both their job and their women, I do.
Jackim
Prole
Posts: 12
Joined: Wed Apr 03, 2013 3:02 am
Location: Canada

Re: Connect to a mysql database online

Post by Jackim »

I've never used this, but it might be a good start:

http://www.keplerproject.org/luasql/manual.html
User avatar
Nal
Prole
Posts: 5
Joined: Mon Apr 08, 2013 4:11 pm
Location: Northern France
Contact:

Re: Connect to a mysql database online

Post by Nal »

I forgot to say I found that too, and to be honest I understand nothing about how to install it :/ .
Men should be able to handle both their job and their women, I do.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Connect to a mysql database online

Post by bartbes »

You probably don't want to do this, because you always end up giving the "keys" to your database to the users. Typically, you create a couple of simple web pages that you can then interact with from your application.
User avatar
Nal
Prole
Posts: 5
Joined: Mon Apr 08, 2013 4:11 pm
Location: Northern France
Contact:

Re: Connect to a mysql database online

Post by Nal »

Thanks for tip ! Can you tell me which way I could interact with web pages from my game ? Is there a librairy I could use or something ?
Men should be able to handle both their job and their women, I do.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Connect to a mysql database online

Post by Robin »

Code: Select all

local http = require "socket.http"
See the documentation. It's built into LÖVE, yay!
Help us help you: attach a .love.
User avatar
Nal
Prole
Posts: 5
Joined: Mon Apr 08, 2013 4:11 pm
Location: Northern France
Contact:

Re: Connect to a mysql database online

Post by Nal »

Exactly what I needed, thanks all ;) .
Men should be able to handle both their job and their women, I do.
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 10 guests