• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Please help me to code AS3 submit my variable to phpMyAdmin Database...🙏

Explorer ,
Sep 11, 2024 Sep 11, 2024

Copy link to clipboard

Copied

pls help me to code as3 to submit my variable to phpmyadmin database, it's suitable for which player can write a feedback to publisher.... pls help

TOPICS
ActionScript , Code , How to

Views

116

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 12, 2024 Sep 12, 2024

Copy link to clipboard

Copied

Have you started the code to share so we can look at it?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 12, 2024 Sep 12, 2024

Copy link to clipboard

Copied

not yet

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 12, 2024 Sep 12, 2024

Copy link to clipboard

Copied

use the filereference class to send and receive variables

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Sep 13, 2024 Sep 13, 2024

Copy link to clipboard

Copied

LATEST

Hi,
I assume you want to save a variable value from Adobe ActionScript 3 (AS3) into a database, probably MySQL or MariaDB.


1. Use the URLRequest class in AS3 to send the data to a PHP script on your server.

Sample code to send data:

 

var request:URLRequest = new URLRequest("http://your-server.com/your-script.php");
var variables:URLVariables = new URLVariables();
variables.data = yourData;
request.data = variables;
request.method = URLRequestMethod.POST;

var loader:URLLoader = new URLLoader();
loader.load(request);

 

 

2. On the server, create a PHP script to receive the data sent from AS3
and insert it into the database using PHP methods to deal with MySQL.

Sample PHP code:

 

<?php
// Get data from AS3
$data = isset($_POST['data']) ? $_POST['data'] : null;

if ($data === null) {
    die("No data received");
}

// Connect to the database
$servername = "localhost";
$username = "yourUsername";
$password = "yourPassword";
$dbname = "yourDatabase";

$conn = new mysqli($servername, $username, $password, $dbname);

// Check the connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

// Prepare and execute the SQL query to insert the data
$sql = "INSERT INTO yourTable (column_name) VALUES ('$data')";

if ($conn->query($sql) === TRUE) {
    echo "New record created successfully";
} else {
    echo "Error: " . $sql . "<br>" . $conn->error;
}

$conn->close();
?>

 


Make sure you have the correct database and server access rights configured.


- Vlad: UX and graphic design, Flash user since 1998
Member of Flanimate Power Tools team - extensions for character animation

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines