5 Replies - 1945 Views - Last Post: 24 March 2012 - 05:27 AM

#1 paparas  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 22-March 12

Flash - PHP Variables problem

Posted 22 March 2012 - 10:50 AM

So, i have a database named "test" with a table named "login" and 2 columns: "username" and "password". I know how to get data from mysql to php, but i dont know how to pass them from php to the flash file. I want to make a game and the first problem is the player stats: ex. name!

php variable = database -> php success!
flash variable = php -> actionscript 3 fail!

I saw lots of tutorials but none worked with me. Can you help me?

Is This A Good Question/Topic? 0
  • +

Replies To: Flash - PHP Variables problem

#2 chinchang  Icon User is offline

  • Indie Game Developer
  • member icon

Reputation: 192
  • View blog
  • Posts: 725
  • Joined: 22-December 08

Re: Flash - PHP Variables problem

Posted 22 March 2012 - 10:54 AM

Can you share the PHP and AS code here which you are using for communication between them...
Was This Post Helpful? 0
  • +
  • -

#3 paparas  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 22-March 12

Re: Flash - PHP Variables problem

Posted 22 March 2012 - 11:10 AM

I dont realy have one. I tryed many codes but none worked. I have this if it helps

<?php

$db = new mysqli('localhost', 'root', '', 'lola');

$query = "select * from login";
$result = $db->query($query);

$row = $result->fetch_assoc();

	$name = $row['username'];
	$pass = $row['password'];

echo $name;
echo $pass;

?>


where lola is the database xD
Was This Post Helpful? 0
  • +
  • -

#4 paparas  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 22-March 12

Re: Flash - PHP Variables problem

Posted 23 March 2012 - 09:21 AM

Cant anyone help me here? I just want to learn how to pass variables from php to flash and the opposite. Fore example, lets say that the player clicks a button and he buys a weapon. His money were 1000, the weapon cost 50 so his money are now 950. So when he pushes the button his row in the money table in the database must be updated from 1000 to 950. It must also retrieve the information from the database to the player's money textfield. Any help here please?
Was This Post Helpful? 0
  • +
  • -

#5 chinchang  Icon User is offline

  • Indie Game Developer
  • member icon

Reputation: 192
  • View blog
  • Posts: 725
  • Joined: 22-December 08

Re: Flash - PHP Variables problem

Posted 24 March 2012 - 01:40 AM

That was your PHP code. What about the Actionscript code?
Was This Post Helpful? 0
  • +
  • -

#6 paparas  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 22-March 12

Re: Flash - PHP Variables problem

Posted 24 March 2012 - 05:27 AM

I dont have one, im new to actionscript, thats why i ask for help.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1