covert text file to MySql Database

covert text file to MySql Database
COntoh Kode dari MySQL Code 1:
1) ‘Codemaster’|’Mohd Izzairi’|’Xyiry’|’Yamin’|’Xyiry Technologies’|’CakePHP’
2) ‘Codemaster’,’Mohd Izzairi’,’Xyiry’,’Yamin’,’Xyiry Technologies’,’CakePHP’
1) baca text file
$file = “/convert/xyiry.txt”; //lokasi file di folder convert
$fp = fopen($file, “r”);
$data = fread($fp, filesize($file));
fclose($fp);
(2) trus pencarian lokasi TAB untuk carakter ( “|” atau “,”)
$output = str_replace(“\t|\t”, “|”, $data);
(3) Penggunaan  function explode utk memecah setiap line break
$output [...]

TEX FILE FROM MYSQL

contoh Function Write TXT from MySQL
function write_txt()
{  $sql = “SELECT aircraf_id,aircraf_registration
FROM tgfis_aircraf “;
$dbc = dbQuery($sql);
if (mysql_num_rows($dbc) >= 1) {
while ($row = mysql_fetch_array($dbc)) {
$reg_id=$row['aircraf_id'];
$reg_reg=$row['aircraf_registration'];
$fp = fopen(“convert/agus.txt”, “a”);
//untuk penggunaan table
fputs($fp, “<table border=0 width=450><tr><td width=130><font face=verdana size=1><b>ID:</b></font></td><td width=320><font face=verdana size=1>”.$reg_id.”</font></td></tr>”);
fputs($fp, “<tr><td><font face=verdana size=1><b>Email:</b></font></td><td><font face=verdana size=1>”.$reg_reg . “</font></td></tr>”);
fputs($fp, “</table><br>”);
//untuk menggunakan tanda ‘|’ or ‘,’
$linebrake   =”ID flight : $reg_id | [...]

Types

 
Introduction
PHP supports eight primitive types.
Four scalar types:

boolean
integer
floating-point number (float)
string

Two compound types:

Basic syntax PHP

 
Escaping from HTML
When PHP parses a file, it simply passes the text of the file through until it encounters one of the special tags which tell it to start interpreting the text as PHP code. The parser then executes all the code it finds, up until it runs into a PHP [...]

What can PHP do?

Anything. PHP is mainly focused on server-side scripting, so you can do anything any other CGI program can do, such as collect form data, generate dynamic page content, or send and receive cookies. But PHP can do much more.There are three main fields where PHP scripts are used.

Server-side scripting. This is the most [...]

What is PHP?

PHP (recursive acronym for “PHP: Hypertext Preprocessor”) is an open-source server-side HTML-embedded scripting language.

PHP – For Loop

The for loop is simply a while loop with a bit more code added to it. The common tasks that are covered by a for loop are:

Set a counter variable to some initial value.
Check to see if the conditional statement is true.
Execute the code within the loop.
Increment a counter at the end of each iteration [...]

PHP

For other uses, see PHP (disambiguation).

PHP

Paradigm
imperative, object-oriented

Appeared in
1995

Designed by
Rasmus Lerdorf

Developer
The PHP Group

Latest release
5.2.5/ 9 November 2007

Typing discipline
Dynamic, weak (duck typing)

Influenced by
C, Perl, Java, C++, Python

OS
Cross-platform

License
PHP License

Website
www.php.net