The Daily Click ::. Forums ::. Klik Coding Help ::. Retrieving a value from a mysql database
 

Post Reply  Post Oekaki 
 

Posted By Message

7Soul



Registered
  12/08/2008
Points
  167
17th February, 2010 at 03:33:44 -

Is there any way to get a value from a database using mmf2? I tried the SQLite3, ODBC and all Moo extensions but i didnt find a way to connect to the database
What i want is some way to get a value form the database and use it inside my application

 
n/a

Fifth

Quadruped

Registered
  07/05/2003
Points
  5818

VIP MemberGOTW JULY 2010 WINNER!Kliktober Special Award TagGOTW HALLOWEEN 2011 WINNERPicture Me This Round 51 Winner!
17th February, 2010 at 03:46:01 -

Hm, I just made a game that does that!

Typically, you're not allowed to send MySQL commands to send/retrieve data from somewhere that isn't on the same server as the database (I think). As such, you'll need to have a php file on the server to act as a go-between.

It's all explained in David N's handy tutorial here: http://www.clickteam.com/eng/resources/online_score/onlinescoreboards.html

 
Go Moon!

nim



Registered
  17/05/2002
Points
  7234
17th February, 2010 at 03:48:08 -

I've never tried, but you'd have more luck getting help if you provided some details. What kind of database is it?

 
//

Cecilectomy

noPE

Registered
  19/03/2005
Points
  305

Has Donated, Thank You!VIP MemberWeekly Picture Me This Winner!Cardboard BoxGhostbuster!Pokemon Ball!ComputerBox RedSanta HatSnowman
I am an April Fool
17th February, 2010 at 04:36:16 -


Originally Posted by Fifth
Hm, I just made a game that does that!

Typically, you're not allowed to send MySQL commands to send/retrieve data from somewhere that isn't on the same server as the database (I think). As such, you'll need to have a php file on the server to act as a go-between.

It's all explained in David N's handy tutorial here: http://www.clickteam.com/eng/resources/online_score/onlinescoreboards.html

im not positive as i cant remember if ive ever tried it or not, but i dont think the script HAS to be on the SAME server as the database. When you connect to a mysql database you have to provide it the servername (or ip adress is acceptable i think) that the database(s) is/are hosted on, the user name, and the password. then you mysql_db_select() the database you want to use for sending queries to.

 
n/a

7Soul



Registered
  12/08/2008
Points
  167
18th February, 2010 at 23:16:38 -

Thanks but i dont think this scoreboard tutorial explains what i need

To be more expecific, I was trying to crate a register/login function for an online game, where the player can register, and then login any time he wants. For that i would use an MySQL database, to store all players names, passwords, scores, characters and stuff

 
n/a

Fifth

Quadruped

Registered
  07/05/2003
Points
  5818

VIP MemberGOTW JULY 2010 WINNER!Kliktober Special Award TagGOTW HALLOWEEN 2011 WINNERPicture Me This Round 51 Winner!
19th February, 2010 at 02:50:45 -

Well, yes, the tutorial is specifically aimed at making an online high score table using php and MySQL, but it pretty much provides an intro to using them in general, in case you don't know how to approach it (as I didn't).

What I was talking about, though, was the line in parentheses in the second paragraph: "(It's possible to communicate directly with some databases from within an MMF application, but the majority of webspace providers don't allow connections to the database from outside the same server.)"

It may be because of such security precautions that you won't just be able to send/retrieve data directly from a MySQL database using your MMF2 program. That's why you'll most likely need a php file or two to do the job.

 
Go Moon!

Solgryn

Solgryn dot org

Registered
  20/12/2008
Points
  12572

GOTW Winner!VIP MemberWii OwnerIt's-a me, Mario!The Cake is a LieGOTM 2ND PLACE! - APRIL 2009GOTM 2ND PLACE - JUNE 2009PS3 OwnerKlikCast #15 Compo Winner!LOL Sign
You've Been Circy'd!GOTM WINNER - JANUARY 2010I am an April FoolGOTW MARCH 2010 WINNER!Santa Hat
23rd February, 2010 at 08:19:47 -

It's quite easy once you have the basic codes. And yes, you will probably need some php files..

I recently learned some of the basics which I made a login system that saves some stats of the character (lvl, exp, HP etc) to the database.

I'll probably make an article explaining it.

Edited by Solgryn

 
www.Solgryn.org

Image
   

Post Reply



 



Advertisement

Worth A Click