phpeveryday.com

The best tutorial of php, php framework, php strategies, object oriented oriented,


Flash Database: PHP for Reading Data

Tag: flash, database, server side   Category: PHP Application
post: 24 Mar 2008 read: 955


Flash Database Step By Step Tutorial - Part 2: In this post, we prepare server side use PHP. There are 3 task of PHP: read data, update data, and display text.

First, we talk about reading data. Create a file named "polling.php" within www/test/flash. Enter with following code:


<?
$file_data = "polling.txt";

// prepare no cache
header("Expires: Mon, 01 Jan 1990 00:00:00 GMT");
header("Last-Modified: ". gmdate("D, d M Y h:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0; pre-check=0", false);
header("Pragma: no-cache");

function readData(){
  global $file_data;
  
  $fp = file($file_data);
  
  while(list($line, $value) = each($fp)){
    print "&" . eregi_replace("\r\n","",$value);
  }
    
}

readData();
?>

Try to open it. Point your browser to http://localhost/test/flash/polling.php. You may get like this:


&title=What database kind do you like?&choice1=Plain Text&choice2=XML&choice3=MySQL&choice4=MsSQL&choice5=Oracle&choice6=SQLite&choice7=PostgreSQL&choice8=Ms Access&choice9=DB4O&choice10=Db2&votes1=0&votes2=0&votes3=0&votes4=0&votes5=0&votes6=0&votes7=0&votes8=0&votes9=0&votes10=0&allow=true

This text will read by flash.



Series this article:
Flash Database: Text File
Flash Database: PHP for Reading Data
Flash Database: Saving Data at Server Side
Flash Database: Switching Task at Server Side
Flash Database: Starting Flash
Flash Database: Making Flash Polling Interface
Flash Database: Giving Action to Submit Polling
Flash Database: Trying Submiting Vote
Flash Database: Preparing Polling Result Interface

| Give Your Opinion | Recommend
Share and Bookmark to: These icons link to social bookmarking sites where readers can share and discover new web pages.
digg del.icio.us technorati Ma.gnolia BlinkList

Recommended articles by other readers:
Web Services: How PHP Kiss VB.NET? (Part 1)
Joomla: Fast Road to Understand Component Programming
Chart: How to Build Cool Animation Real Time Chart
Email: Send Attachement Mail
SMS : Sending SMS with PHP and ActiveXperts (Part 1)

What do You Think?
Your Name *:
Email *:
(Will not be published)
Website/URL:
Your Comment *:
* Required


624
posting