473,799 Members | 2,941 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Send value from Flash to database with PHP

11 New Member
Hi!

This has been posted in the flash-forum as well.

I know a solution for this problem and that is using this code:

PHP: (submitScore.ph p)
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $nick = $_POST['Nick'];
  3. $score = $_POST['Score'];
  4. $kills = $_POST['Kills'];
  5. $floor = $_POST['FloorNr'];
  6.  
  7. $db=mysql_connect("")
  8. or die("Couldn't connect.");
  9. mysql_select_db("databasename", $db);
  10.  
  11. mysql_query("INSERT INTO Table (Nickname,Score,Kills,Floor) VALUES ('$nick','$score','$kills','$floor')",$db);
  12.  
  13. mysql_close($db);
  14. echo "Your score has been submited! ";
  15. ?>
  16.  
Actionscript:
Expand|Select|Wrap|Line Numbers
  1. myData = new LoadVars();
  2. myData.Nick = nickname.text;
  3. myData.Score = _global.score;
  4. myData.Kills = _global.TotalKills;
  5. myData.FloorNr = _global.floorNr;
  6.  
  7. myData.send("submitScore.php", myData, "POST");
  8.  
The problem with this is that submitScore.php pops up in the browser so that
the player can just refresh the submitScore.php page and in such a way
repeat the insert query to the database, adding the score several times.
Either I can make the page close down on its own or is there a way to insert a
value to a database without making the submitScore.php pup up and accessible
to the user?
Jun 4 '07 #1
2 1565
pbmods
5,821 Recognized Expert Expert
You could set up a unique key in your MySQL database to disallow duplicate posts.
Jun 4 '07 #2
Motoma
3,237 Recognized Expert Specialist
Have the submitScore page do the update, then redirect to a message screen. When the page is refreshed, it will just the the message screen, and not the submission.
Jun 5 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

5
3377
by: Mirco | last post by:
Hi I have a page written with php and a MySQL Database. Now, I want to redesign the whole, but still with the Database and php. is it possible to design the page with Flash and then to put all the php commands into the source code? specially, I still need the extension *.php? Greets and thanks in advance mirco
30
3724
by: Darren Gates | last post by:
hi PHP users, Here's a Flash 7 version of phpMyAdmin: http://www.tufat.com/phpflashmyadmin.php Special features include: drag-and-drop interface for InnoDB table relationships, quick record editing, tree-menu display for databases and tables, support for multiple hosts, and much more...
1
5065
by: VB Programmer | last post by:
Anyone have any ideas how I can use Flash as my GUI to send an email and have an ASP.NET post actually send the email (via system.web.mail)? Thanks!
0
2263
by: ArtDerailed | last post by:
Hello there, I too am having a somewhat similar problem and would very much appreciate some assistance. Through PHP, I have already set up my Flash actionscript to pass info and variables onto a MySQL database that is functionable in retrieving user info (name, email, subject, and comments). My only problem is that I need to have the information that the user sends when the click submit to also send an email to the owner with the same info. He...
4
2488
by: Joseph Geretz | last post by:
We use a Soap Header to pass a token class (m_Token) back and forth with authenticated session information. Given the following implementation for our Logout method, I vastly prefer to simply code m_Token = null in order to destroy the session token when the user logs out. However, I'm finding that setting class instance to null results in no header being sent back to the client, with the result that the client actually remains with an...
1
6939
by: molle | last post by:
Hi! I know a solution for this problem and that is using this code: PHP: (submitScore.php) <CODE> <?php $nick = $_POST; $score = $_POST; $kills = $_POST;
0
2766
by: zechdc | last post by:
I have been at this for two weeks now. I am trying to send two variables from a flash file located on newgrounds.com, kongregate.com, armorgames.com or any other site like that to a php file on my site pogolama.com. I have read through most of the adobe manuals for security and still have no Idea how to use those features, that's why there are so many variations of them in my code. I can not figure out why my php file will not get the...
2
1952
by: vimal.424 | last post by:
Dear All, Please help me......... Please tell me how can we store the flash movie in data base,after storing how can we retreive flash movie from data base. I want have to do, also the preview the flash movie before save in database.............. thanks in advance
9
2805
by: raknin | last post by:
Hi, I am using PHP on the server side and javascript on the client side. I ecounter a problem when I try to send to the server parameter with value of 350 charecter and more. I know that I can split the string I send, and send it saperatly to the server and then reassemble it on the server. My question is how can I transfer to the server string with 350 char and more in native manner. For example if I try to transfer: <object...
0
9540
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10475
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10250
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10222
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10026
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9068
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6805
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5463
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5585
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.