• Image 1
  • Image 2
  • Image 3
  • Image 4
  • Image 5
  • Image 6
  • Image 7




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

Thursday, September 6, 2012

INTRODUCTION OF PHP


Hi.. hi.. hi visitors.. welcome to my site.. you are on my blog, at “We Are Knowledge”… Previosly you know about this blog ?? oh my god.. you do not know..!!! this is blog to fill many IT knowledge and general knowledge..

You will getting many IT knowledge and general knowledgein here FREE. you can to learn from element. So let’s share this blog to your friend in order to he knows it too, and can take the knowledge he needed here.

From program language based web programming until program language based dekstop progamming here. Web programming like as :  PHP, javascript, HTML. And for dekstop programming like as : cobol, c++, pascal and other program language.oh I am forget in here also to be found visual basic 6 (six).

But now… I want writing article about program language based web programming, tht is “PHP”.. you will know ?? you will to learn ?? yo will getting it ?? let’s do read this article.. have fun for reading the readers.

Before you know the whole of PHP, it helps me introduce first. PHP is program language usually used for making web. The programmer using it in order to the web more sophisticated look. Using the PHP we are also can “database”, because use php will not come off with the use of database. For the database you can using “MYSQL”. For to learn it you must having the “xampp” software. This software you can getting FREE. You can search in “WWW”.

Making PHP program you can using notepad or notepad ++, according to my advice, you better use a notepad + +, notepad + + because you are made ​​easy with the color of the words that you write. ie, for a given syntax color blue, untu comments are colored green.

And don’t forget because you using notepad, before you store your work files you must change the “save as type” from .txt to .php. if you not change, when you will running with double click or right-click then open the file will open with the application instead search engine. If you right the file will openning with your search engine


Ok.. just it for this time..
I hope you like with my article…
See you later..

Sunday, August 5, 2012

DELETE DATABASE IN PHP


Hi… welcome in my blog… In here you want getting many IT knowledge..

Now.. I want giving you IT knowledge about PHP and discuss of “DELETE DATABASE IN PHP”.

Previous I was giving tutorial about “INPUT and EDIT DATABASE IN PHP”.

Ok … direcrt to go !!

For deleting database in PHP we are need4 (four) components.. they are is :

1. DATABASE
2. FILE CONNECTION.PHP
3. FILE DISPLAY.PHP
4. FILE ACTION.PHP


We are start from DATABASE until FILE ACTION.PHP


1. DATABASE

I was giving tutorial about database if you do not know please visit in

http://have-fun-and-enjoy.blogspot.com/2012/07/create-database-and-table-in-mysql.html


2. FILE CONNECTION.PHP

http://have-fun-and-enjoy.blogspot.com/2012/08/connection-in-php.html


3. FILE DISPLAY.PHP

In making file display.php likely file display.php for edit… but action of edit I change with action of delete…

Ok.. you can copy this coding and paste in your notepad

<html>
<head>
<title></title>
<head>
<body>

<?php
include "connection.php";
$aksi="action.php";

switch($_GET[act])
{
default:

echo "<table border=1 <tr> <th> ID MHS </th> <th> NAME MHS </th> <th> SEX MHS </th> <th> DATE MHS </th> <th> ADDRESS </th> <th> ACTION </th> </tr>";

$a               = "select * from adsanse";
$b               = mysql_query($a);
while ($r = mysql_fetch_array($b))
{
$id              = $r[id];
$name      = $r[name];
$sex           = $r[sex];
$born        = $r[born];
$address  = $r[address];

echo "<tr> <td align = center> $id </td> <td> $name </td> <td> $sex </td> <td> $born </td> <td> $address </td>
<td align = center> <a href='$aksi?module=product&act=delete&id=$r[id]'> delete </a></td>
</tr>";
}

break;

}
?>

</table>
</body>
</html>

If it is save with save astype “PHP” and give name “select.php”.


4. FILE ACTION.PHP

This file for processing… you can copy this coding and paste to notepad

<?php
include "connection.php";
$module=$_GET[module];
$act=$_GET[act];


if ($module=='product' AND $act=='delete')
{
$a = $_POST[year].'-'.$_POST[moon].'-'.$_POST[day];  

mysql_query("DELETE from adsanse where id = '$_GET[id]'");                                                                                                               
 }
else
{
echo "failed";
}
?>


DON’T forget give name “action.php”… if not this file not exist…


NOTE : :

Give name of second file “action.php”.
If you using copy and paste you must change all quotes (“ “) or (‘ ‘)
for working you must open XAMPP and trun on “apache”, and “mysql”.
Open your browser and write “localhost/select.php” >> enter


Ok.. just for it..
I hope you understand with my article…
See you later..

Saturday, August 4, 2012

EDIT DATABASE IN PHP


Hi… welcome to my blog… 
In here you want getting many IT knowledge, like as : PHP, MYSQL, HTML, and other knowledge…

Previous I was giving tutorial about PHP and explain of “input database from php” and “display database with PHP”…

Now I want givingyou tutorial PHP about “EDIT DATABASE IN PHP”…
You ready… ?? if yes.. let’s read this article…

For edit database in PHP we need 4 (four) component.. they are :
   1. DATABASE
   2. FILE CONNECTION.PHP
   3. FILE DISPLAY.PHP
   4. FILE ACTION.PHP


Ok ,,, we are start from making database until making file action.php


1. DATABASE

Database is place for saving datas, like as : name, born, address, and other. We can input variable integer, character, or date… we also cana inputting primary key and auto_increment
I was disscus about it.. if you do not know you can visit in


2. FILE CONNECTION

File conection include “localhost”, “root”, “pass”, “database”.


3. FILE DISPLAY

You can copy and paste this coding in your notepad


<html>
<head>
<title></title>
<head>
<body>

<?php
include "koneksi.php";
$aksi="action.php";

switch($_GET[act]){
default:

echo "<table border=1> <tr> <th> ID MHS </th> <th>NAMA MHS </th> <th> SEX MHS</th><th>DATE MHS</th><th>ADDRESS</th><th>ACTION</th></tr>";

$a = "select * from adsanse";
$b = mysql_query($a);
while ($r = mysql_fetch_array($b))
{
$id                    = $r[id];
$name             = $r[name];
$sex                  = $r[sex];
$born               = $r[born];
$address           = $r[address];

echo "<tr> <td align = center> $id </td> <td> $name </td> <td> $sex </td> <td> $born </td> <td> $address</td><td>
<a href=?module=product&act=editproduk&id=$r[id]>Edit</a>
</tr>";
}

break;

case "editproduk":
$edit = mysql_query("SELECT * FROM adsanse WHERE id='$_GET[id]'");
 $r    = mysql_fetch_array($edit);
           
echo "<h2>Edit PRODUCT</h2>
<form method=POST enctype='multipart/form-data' action=$aksi module=product&act=update>
        
<input type=hidden name='id' value='$r[id]'>
<table>
<tr><td width=70>Name MHS</td>     <td> : <input type=text name=name size=60 value='$r[name]'></td></tr>
<tr><td width=70>sex      </td>     <td> : <input type=radio name=sex size=60 value=MAN>MAN<input type=radio name=sex size=60 value=WOMAN>WOMAN</td></tr>
                         
<tr><td width=70>date</td>     <td> :
<select name=year>
<option value = 0        >-/-</option>
<option value = 1990>1990</option>
 <option value = 1991>1991</option>
<option value = 1992>1992</option>
<option value = 1993>1993</option>
<option value = 1994>1994</option>
</select>
 <select name=moon>
<option value = 01>jan</option>
<option value = 02>feb</option>
<option value = 03>mar</option>
<option value = 05>mei</option>
</select>
</select>
<select name=day>
<option value = 01>01</option>
<option value = 02>02</option>
<option value = 03>03</option>
<option value = 04>04</option>
<option value = 05>05</option>
</select>
 </td></tr>
                         
<tr><td width=70>address</td>     <td> : <textarea name=address cols = 14 rows = 3 > $r[address] </textarea></td></tr>
 <tr><td colspan=2><input type=submit value=Update>
<input type=button value=Batal OnClick=self.history.back()></td></tr>
</table></form>";
break; 

}
?>
</table>
</body>
</html>

Give name = select.PHP…


4. FILE ACTION.PHP

You can too copy this file and paste in your notepad….

<?php
include "koneksi.php";
$module=$_GET[module];
$act=$_GET[act];


if ($module=='product' AND $act=='update')
{

$a = $_POST[year].'-'.$_POST[moon].'-'.$_POST[day];        

mysql_query("UPDATE adsanse SET name = '$_POST[name]',  sex = '$_POST[sex]',  born     = '$a', address        = '$_POST[address]' WHERE id  = '$_POST[id]'") ;
                                                                                   
 }

else

{

echo "failed";

}
  ?>

DON’T FORGET… GIVE name  = “action.php”


NOTE ::

IF you using copy and paste… please change all quotes ( “ “ ) or ( ‘ ‘ ).
For execution trun on xampp and start “apache” and “mysql”



OK just it …
I hope you understand with this all…
See you later

Friday, August 3, 2012

DISPLAY DATABASE IN PHP


Hi…  welcome to my blog in “We Are Knowledge”… In here you want getting many IT knowledge like as : PHP, MYSQL, VB, COBOL, PASCAK, and other.. We aslo provide many article…

Now.. I want giving you knowledge about PHP and MYSQL, and discuss is “DISPLAY DATABASE IN PHP”..

You know previous ??? If not… Let’s read it !!

For adisplay database in php we are need 3 (three) components. And the components is :

1. DATABASE (in mysql)
2. FILE CONNECTION.PHP
3. FILE DISPLAY.PHP

OK  we are started in sequence..


1. DATABASE

Database is place for saving datas, like as : name, born, address, and other. We can input variable integer, character, or date…
I was disscus about it.. if you do not know you can visit in


2. FILE CONNECTION.PHP

This is file for connection database wirh File display.php.. If you not use it then your coding want error.. I also was discuss about it.. and if you do not know you can too visit in


3. FILE DISPLAY.PHP

You can copy this coding

<html>
<head>
<title></title>
<head>
<body>

<?php
include "koneksi.php";
echo "<table border = 1> <tr> <th> ID MHS </th> <th> NAME MHS </th> <th> SEX MHS </th> <th> DATE MHS </th> <th> ALAMAT </th> </tr>";

$a = "select * from adsanse";
$b = mysql_query($a);
while ($r = mysql_fetch_array($b))
{
$id               = $r [id];
$name       = $r [name];
$sex            = $r [sex];
$born        = $r [born];
$address = $r [address];
echo "<tr> <td align=center> $id </td> <td> $name </td> <td> $sex</td> <td> $born </td> <td> $address </td>
</tr>";
}

?>
</table>
</body>
</html>


If it is you can give name “select.php”.. AND you MUST save as type “PHP”.

NOTE :

IF you using copy + paste please change all quotes (“ “) or (‘ ‘)
name database is = adsanse
name table         is = adsanse
for working you must trun on apache and mysql in "xampp".
write "localhost/insert.html" in your search engine for try the program.
put your saving in folder "htdoc" of xampp.



Ok.. just it 
Thanks for reader…
I hope you understand with this all…
See you later…

INPUT DATABASE FROM PHP


Hi… welcome in my page…

Now. I want to giving you about PHP and discuss of “program input from php to mysql” or “input database from PHP”. You will know ??? let’s reading this article..

In inputing data from PHP to MYSQL (database) you must have 3 (three) component like as :
  • Database
  • Form for inputing
  • Connenction
  • Syntax for inputing to mysql (database)


1. DATABASE

Database is program for saving data. The data can be name, date, address, sex and other…
I ever discuss it… if you not know please visit to

http://have-fun-and-enjoy.blogspot.com/2012/07/create-database-and-table-in-mysql.html


2. FORM FOR INPUTING

You must having it for inputing…
You can copy this coding and paste in your notepad

<html>
<head>
<title></title>
</head>
<body>
<form method = "POST" action = "input.php">
<table border = "0" cellpadding = 1 cellspacing = 1 align = center>
<tr>
<td>nama</td><td><input type = text name = "nama"></td>
</tr>
<tr>
<td>sex</td><td><input type = radio name = "sex" value = "Man">Man
<input type = radio name = "sex" value = "Woman">Woman</td>
</tr>
<tr>
<td>date</td>
<td>
<select name = "date">
<option value = "01">01</option>
<option value = "02">02</option>
<option value = "03">03</option>
<option value = "04">04</option>
<option value = "05">05</option>
<option value = "06">06</option>
</select>
<select name = "moon">
<option value = "01">jan</option>
<option value = "02">feb</option>
<option value = "03">mar</option>
<option value = "04">apr</option>
<option value = "05">mai</option>
<option value = "06">jun</option>
</select>
<select name = "year">
<option value = "1990">90</option>
<option value = "1991">91</option>
<option value = "1992">92</option>
<option value = "1993">93</option>
<option value = "1994">94</option>
<option value = "1995">95</option>
</select>
</td>
</tr>
<tr>
<td>alamat</td><td><textarea cols = 17 rows 3 name = "live"></textarea></td>
</tr>
<tr>
<td></td><td align = center ><input type = submit value = "SAVE"></td>
</table>
</form>
</body>
</html>

If its give name “insert.html”


3. CONNECTION

<?php
$host = "localhost";
$user = "root";
$pass = "";
$db   = "adsanse";
$a    = mysql_connect($host, $user, $pass);
$b    = mysql_select_db($db, $a);
if ($b)
{
echo "succes to connect";
}
else
{
echo "failed to connect";
}
?>

If its give name “connection.html”



4. SYNTAX FOR INPUTING TO MYSQL(DATABASE)

<?php
include " connection .php";
$nm       = $_POST['nama'];
$jk          = $_POST['sex'];
$dt             = $_POST['year'].'-'.$_POST['monn'].'-'.$_POST['date'];
$alamat = $_POST['live'];

$a = "insert into adsanse(name, sex, born, address) values ('$nm', '$jk', '$dt', '$alamat')";
$b = mysql_query($a);
if ($b)
{
echo "succes to input";
}
else
{
echo "failed to input";
}
?>

If its give name “input.php”

NOTE :
If you using copy + paste  >> please change all quote (" ") because if not.. want error
for working you must trun on apache and mysql in "xampp".
write "localhost/insert.html" in your search engine for try the program.
put your saving in folder "htdoc" of xampp.
for saw your was input, open mysql... and write "select * from adsanse; >> enter"


Ok just it...
if you will questions, please leave a comment...
Thanks for reader...
see you later

Wednesday, August 1, 2012

CONNECTION IN PHP


Hi… welcome to my blog in “We Are Knoewledge” Iwant giving you IT knowledge in here… you can follow me for easely in learn…

Now, I wan giving you tutor PHP about making file “connection”.. you know what for this file… ??
Yes that’s right.. this file usefull connection between file.php with database in mysql…

For more details we direct to progam coding..

1. frist you must creating database in mysql and the tutorial was I made in 

If you was understandand and making you just make conection.php..

You can copy this coding or you write self in orde to you can more easily in undestand..

<?php
$host = "localhost";
$user = "root";
$pass = "";
$db   = "adsanse";
$a = mysql_connect($host, $user, $pass);
$b = mysql_select_db($db, $a);
if ($b)
{
Echo "your connection is ready";
}
Else
{
Echo "your connection is failed, maybe your query is wrong, please check again";
}
?>


Note :

  • If you using copy + paste you must change all quotes (“) if you not change the file error
  • Save with save as type “PHP” ex : connection.php.
  • Put in folder “htdoc” in xampp
  • For working please trun on in xampp is “apache” and “mysql”..
  • Open your search engine and write “localhost/connection.php” >> enter
  • $host = "localhost";   >> server from xampp you should not be to change
  • $user = "root";           >> this should not be to change too
  • $pass = "";                    >> because the xampp not use pass, then pass we are clear
  • $db   = "adsanse";     >> this is name of database
  • Syntax for connecting :
  • $a = mysql_connect($host, $user, $pass);
  • $b = mysql_select_db($db, $a);


If to result is :
connection is failed, maybe your query is wrong, please check again
your program is true

If to result is :
your connection is failed, maybe your query is wrong, please check again
your program to be something errors.


Ok.. just for it…
I hope you understand with my article…
Thanks for the readers….
See you later

Monday, July 30, 2012

METHOD POST IN PHP


Hi… welcome… in my page….

Still in PHP… yeah…

Now… I want to giving you about PHP and title discuss of “method POST in PHP”.. Yon know previous…???.. Method POST in PHP is command for go to other page or other “url”… Usually programmer using “button” for move or goto other url…

Ok.. direct in program…., I want making program using “checkbox”, “radio”. … ok check it….

You can copy this coding and paste in your notepad

First step :

<html>
<head> METHOD POST IN PHP <br> <br> <br>
<title> WE ARE KNOWLEDGE </title>
</head>
<body>
<form method = POST action = "20.php">
<?php
echo "<table border = 7>
<tr> <td> HARDWARE </td> <td>
<input type = radio name = r value = HARDISK> HARDISK  <br>
<input type = radio name = r value = DVD ROOM> DVD ROOM  <br>
<input type = radio name = r value = FLASH_DISK> FLASH DISK <br>
<input type = radio name = r value = MODEM> MODEM  <br>
<input type = radio name = r value = SOUND_CARD> SOUND CARD <br></td>
</tr>
<tr>
<td> SOFTWARE </td> <td>
<input type = checkbox name = 's[]' value = PHP> PHP <br>
<input type = checkbox name = 's[]' value = VB.NET> VB.NET <br>
<input type = checkbox name = 's[]' value = HTML> HTML <br>
<input type = checkbox name = 's[]' value = JAVASCRIPT> JAVASCRIPT <br>
<input type = checkbox name = 's[]' value = ORACLE> ORACLE <br> </td>
</tr>
<tr>
<td> </td> <td> <input type = submit value = SEND </td>
</tr>
</table>";
?>
</body>
</html>

Save with save as type = ”PHP”.

Second step :
Copy this coding and paste in your notepad


<?php
$a = count($_POST['s']);
echo $_POST[r]."<br>"."<br>";
for ($x = 0; $x < $a; $x++)
{
echo $_POST['s'][$x]."<br>";
}
?>


If it save with save as type = “PHP”.. DON’T forgt give name = “20.php”
………..
……….

And result:

METHOD POST IN PHP



Top of Form
HARDWARE
 HARDISK
 DVD ROOM
 FLASH DISK
 MODEM
 SOUND CARD 
SOFTWARE
 PHP
 VB.NET
 HTML
 JAVASCRIPT
 ORACLE 
<="" td="">


If you choice  flash disk, php, vb.net, oracle … and clcik “send’
Result is
FLASH_DISK

PHP
VB.NET
ORACLE


Ok.. just it.. I hope you understand with this all…
Thanks for you
Se you later..