Jump to content

Connect table in phpmyadmin with flash?


emma2288

Recommended Posts

Hi everyone..

 

I am extrememly new to all things related to PHP.. to be honest I dont know anything about it!

 

One of my projects at uni though it to create an online game with a leader board.

 

So far I have created my game (which includes scores in a dynamic text field) and I have used phpMyAdmin to create a table/database.

 

What I would like to know is how to I make it so the scores from my flash game go into this table? I have spent about 8 hours today viewing tutorials online but most of them are aimed at people who know a little about php so I dont have a clue whats going on!

 

so far I have created this small form that can be filled in online

 

html>
<head><title>Form</title>
</head>
<body>

<form action="inputdata.php" method="post" >
<p> What's your first name? <input type="text" name="myname"> </p>
<p> What's your last name? 
<input name="mycity" type="text" id="mycity">
</p>
<p> <input type="submit" name="Submit" value="Submit"> </p>
</form>
</body>
</html>

this links to this:

<?php
include('connect.php'); 
$myname = $_POST["myname"];
$mycity = $_POST["mycity"];
if (!@mysql_select_db($dbName)) {
print ("Could not select database...");
exit;
}
if (($myname != "")&&($mycity != "")) {
$query = "INSERT INTO test3 (score,firstname,lastname) VALUES ('0','$myname', '$mycity')";
$result = @mysql_query($query);
if (!$result) {
print ("Could not insert data \n");
} else {
print ("Data added sucessfully \n");
}
}else{
print ("Please fill in both fields and <a href='form.html'>try again</a>.");
}
mysql_close();
?>

So now how to I get this into my flash game? The name of my table is 'test 3' if that helps?

 

I'm sorry but I dont know anything about this stuff so it will have to be explained in detail :(

Any help appreciated

 

Emma (stressed)

 

 

Link to comment
Share on other sites

Probably the best way is to use XML in your Flash app, and have it call a PHP page that returns the info you need.  Then you just process the info in your flash app however you need to.

 

I've done this once or twice but am not fluent enough it how to do it to give you any pointers.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.