PDA

View Full Version : C# XNA help passing things to php?? :S



jaymo
10-19-2011, 06:30 PM
I'm kind of a beginner to C#, I know the basics and little bit more and have been learning XNA. I have made a few small games which were very basic. I was just wondering if it is possible to pass information over from a game to say a mysql database? Is it even possible. As I wanted to be able to send scores etc over and retrieve them.

Thanks
James

bluegman991
10-19-2011, 06:55 PM
There is a mysql add on for C#.

Mysql with Visual Basic/C#/.NET/Powershell (http://dev.mysql.com/usingmysql/dotnet/)

Danny696
10-19-2011, 08:45 PM
Are you sure you want to use MySQL with C#? Surley there are better purposely built databases for C#?

a_bertrand
10-20-2011, 05:06 AM
Use the mysql dot net connector:
http://dev.mysql.com/downloads/connector/net/5.1.html

Or if you want to use Linq use something like:
http://www.devart.com/linqconnect/

I personally use LINQ exclusively since a year, much faster to develop, safer, and code lot more readable.

Now if you want at any costs to have your C# code "chatting" with a PHP code, I would suggest to make a web service via PHP and call it from C# as C# have a full integrated solution for SOAP. You may want to check:
http://php.net/manual/en/book.soap.php

Nickson
10-20-2011, 08:29 PM
In addition to what a_bertrand has said above. Make sure you know what you want to do! From reading the posts title, I get the impression that you want to pass things from the c#/xna code to php. While you speak of connecting to a mysql database in your topic.. These are two different things which have different solutions.

Connecting to a mysql database is rather easy in .net, use the link a_bertrand provided.

Spudinski
10-26-2011, 10:23 AM
I'm with a_b on that one.
If you are hosting the database server at a remote location, the closest relatives to the database server should handle the communication to the database.

Why?
Assuming you are making a client with C# and the server with PHP, then the client could easily overlook what's being sent over the network.
If you need to have a database on the clientside, I'd suggest a simple Flatfile db, or even access. The client could just periodically send the altered version of the database over to the server. This would, of course, come at a cost: less strain on the server and more secure, but there would be delays on the server side.

Nickson
10-26-2011, 02:26 PM
I wouldn't suggest to use flatfile or access on the client side, if you're working with .net you can just use the integrated datasets and data structures available.

Spudinski
10-26-2011, 09:49 PM
I wouldn't suggest to use flatfile or access on the client side, if you're working with .net you can just use the integrated datasets and data structures available.
Ah, that would work as well. I just didn't know about that feature.