Showing posts with label Flash PHP MySql. Show all posts
Showing posts with label Flash PHP MySql. Show all posts

Flash PHP Tutorial: How To Insert Data From Database Using Flash with PHP

This video learn how to insert data from database using Flash with PHP.



1- Watch Related Video
https://www.youtube.com/watch?v=jgQpnL3ip9E

2- Create file new_student.php in XAMPP ('C:\xampp\htdocs\phpflash')

<?php
      //Capture data from $_POST array
      $name = $_POST['Fullname'];
      //Connection to database
      $connect = mysql_connect("localhost", "root", "");
      mysql_select_db ("mydb", $connect);
      //Perform the query
      $result = mysql_query("INSERT INTO students (fullname) VALUES ('$name')");
?>

3- Create flash project "new_student.fla"

- Insert Text Tool and then set instance name 'Fullname'
- Insert Button from Components and then set instance name 'submit'

Write codes in Actions - Frame

submit.addEventListener("mouseDown", sendData);
function sendData(evt:Event)
{
//for those using PHP
var students:URLRequest = new URLRequest("http://localhost/phpflash/new_student.php");
students.method = URLRequestMethod.POST;
var posts:URLVariables = new URLVariables();
posts.Fullname = Fullname.text;
students.data = posts;

var loader:URLLoader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.VARIABLES;
loader.load(students);
}

4- demo
http://downloads.ziddu.com/download/24366374/phpflash_1.zip.html

Read more blog:
http://video-tutorial-from-youtube.blogspot.com/

Follow Us with Facebook
https://www.facebook.com/pages/PHP-Tutorial/782239958529506

Flash PHP Tutorial: How To Display Data From Database Using Flash with PHP

This video learn how to display data from database using Flash with PHP.



1- Create Database 'mydb' in phpmyadmin and then create table 'students'

Table Fields:

- studentid
- fullname

2- Create file student.php in XAMPP ('C:\xampp\htdocs\phpflash')

<?php

$link = mysql_connect("localhost", "root", "");
mysql_select_db("mydb");

$query = "select * from students";
$results = mysql_query($query);
 
echo "<?xml version=\"1.0\"?>\n";
echo "<students>\n";
while($line = mysql_fetch_array($results)){
echo "<name>" . $line["fullname"] . "</name>\n";
}
echo "</students>\n";
mysql_close($link);

?>

3- Create flash project "student.fla"

Insert list from Components

Write codes in Actions - Frame

var theXML:XML = new XML();
theXML.ignoreWhite = true;

theXML.onLoad = function()
{
var nodes = this.firstChild.childNodes;
for (i = 0; i < nodes.length; i++)
{
theList.addItem(nodes[i].firstChild.nodeValue,i);
}
};
theXML.load("http://localhost/phpflash/student.php");

4- demo
http://downloads.ziddu.com/download/24366143/phpflash.zip.html

Read more blog:
http://video-tutorial-from-youtube.blogspot.com/

Follow Us with Facebook
https://www.facebook.com/pages/PHP-Tutorial/782239958529506