aspose file tools*
The moose likes Applets and the fly likes Get Results from a PHP Query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "Get Results from a PHP Query" Watch "Get Results from a PHP Query" New topic
Author

Get Results from a PHP Query

Alexis Michael
Greenhorn

Joined: Mar 29, 2009
Posts: 9
Hi,

I am planning to create an online multiplayer game, using a Java applet. I do not want to use JDBC inside my applet, nor use servlets, so I turned to good ol' PHP.

The problem is, I don't know how to retrieve the results from a PHP query to my SQL database, and store them in my applet variables.

Any help or sample code would be great.

Thanks,
Alex
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

Your server can embed initialization information into the page the applet is embedded in -- i.e., if you generate the HTML dynamically on your server (using PHP!) then your applet can be initialized from whatever information you embed in the page.

The actual applet coded will be running on the client (desktop) machine, so once the page is created, all it can do is contact your server over the network. That means it can, for example, use HTTP "POST" requests to send queries, and get results back.


[Jess in Action][AskingGoodQuestions]
Alexis Michael
Greenhorn

Joined: Mar 29, 2009
Posts: 9
use HTTP "POST" requests to send queries, and get results back.


this is my question actually how do i get those results back? do i have the php script create an html page with the results, and then get that output through a streaming reader in my applet?
 
jQuery in Action, 2nd edition
 
subject: Get Results from a PHP Query