accessing an sql database
Displaying 1-6 of 6 total.
1
Please enter a numerical value for the importance of this sticky.
Enter 0 to unsticky.
IkimashoZ

I've got a game on my website (see http://kanji.languagesite.net/) that I'd like to redevelop outside of PHP in something more like a true game environment. Mostly I want to simplify the interface -- allow players to do things like attack by clicking and dragging thier kanji onto rival kanji, or chaining kanji by selecting multiple squares and before typing the reading.

Anywho, I have no doubt that verge can accomplish those things, based on my experience with it, what I want to be able to do is use verge to connect to the database on my site, or, failing that, at least be able to access files on my webserver (so as to be able to store and retrieve information about the world, items owned, etc), though sql would certainly be more secure.

Am I barking up the wrong tree? Is this kind of networking not possible with the current netcode structure? After looking through the manual, I'm honestly not too clear on how this works. It was designed for verge to be able to connect to another computer playing the same verge game, correct?

Posted on 2006-10-26 22:02:56

Kildorf

There isn't anything for accessing SQL databases directly, no. Which actually is kind of unfortunate!

However, you might want to take a look at GetUrlText and GetUrlImage. These will let you do 'net queries and so you could write yourself some PHP database wrappers and just work with those. Unfortunately, as you say, it's going to be somewhat less secure, but with a sufficient amount of mucking around I'm sure you could come up with something workable.

Posted on 2006-10-27 06:41:46

mcgrue

Sully demonstrates what Kildorf is talking about with the tagboard feature, btw.

Posted on 2006-10-27 14:53:07

Glenshope

Would it not be nearly as easy just to write a server code that your client code runs off of, then you could just check the mySQL database locally if needed. It just always seemed easier for me to work with a server then to have to send and receive from a URL.

Posted on 2007-05-07 17:51:05 (last edited on 2007-05-07 17:51:34)

Overkill

Quote:Originally posted by Glenshope

Would it not be nearly as easy just to write a server code that your client code runs off of, then you could just check the mySQL database locally if needed. It just always seemed easier for me to work with a server then to have to send and receive from a URL.
It depends on what you're writing, really. So, not necessarily, since you'd need to write your own server from scratch, and do a bunch of annoying things with sockets, and design an efficient package exchange between both sides, and then reliably have that server on for other people, which sounds like a pain. And you'd be forced to do it on a local machine, because most webhosts I've heard of don't let you run custom services like that.

Instead of that, you could just be simply writing a PHP page that runs off an Apache server, and then use something like this in VC to interact...
result = GetUrlText("whateverlinkthinggoeshere/get_kanji.php?date=2007-05-07");
...which can be easily parsed on both server and cleint side and spew results back that can then be cached on the client's computer. BUT this only works well if you have very small amount of activity between client and server, and don't need near real-time feedback.

But if you're doing a lot of interaction, then making your own server code is likely less work. At any rate, netcode isn't very pretty, at any rate, especially when interacting with Verge on only one end in my experience.

EDIT: Gasp, there are bugs in the link parsing! And apparently, it likes to parse inside pre tags!

Posted on 2007-05-07 20:38:32 (last edited on 2007-05-07 20:41:40)

Nexus

You can access mysql through php scripts with VergeC.


Set up something like this in Verge
int x = 12;
string y = "Something";
string z;
z = GetUrlText("http://website.com/yourscript.php?x="+str(x)+"&y="+y);


Get variable input from verge in a PHP script like so:
$int_from_verge = $_GET['x'];
$string_from_verge = $_GET['y'];
// access mysql table and make changes or get a $result
echo $result;


string z in Verge will be $result from your php script.

Posted on 2008-08-10 10:08:41


Displaying 1-6 of 6 total.
1
 
Newest messages

Ben McGraw's lovingly crafted this website from scratch for years.
It's a lot prettier this go around because of Jon Wofford.
Verge-rpg.com is a member of the lunarnet irc network, and would like to take this opportunity to remind you that regardless how babies taste, it is wrong to eat them.