Connection MySQL With PHP

Connection MySQL With PHP

To connection database on MySQL in this articel we using 3 method :
1.Create Data base
2.Create Table
3.Insert Record
4.Make File test_mysql.php
5.Running on web browser

Step-1.Create Database

Paste this coding into Window SQL in PHPMyAdmin window.
Create database test;

Step-2.Create table into database test.

Paste this Code into Sql Windows

CREATE TABLE `test`.`table_tes` (
`id` INT NOT NULL AUTO_INCREMENT ,
`first_name` VARCHAR( 25 ) NOT NULL ,
`last_name` VARCHAR( 25 ) NOT NULL ,
`email` VARCHAR( 25 ) NOT NULL ,
`city` VARCHAR( 25 ) NOT NULL ,
PRIMARY KEY ( `id` )
) ENGINE = MYISAM

Step-3.Insert record into table table_tes

Paste this code into SQL window make sure database test is choise.

INSERT INTO `test`.`table_tes` (`id` ,`first_name` ,`last_name` ,`email` ,`city`)
VALUES (NULL , 'Adam', 'Moh', 'adam@aol.com', 'Lhokseumawe');

Step-4.Make File test_mysql.php

Make File and save with name test_mysql.php save on htdocs
Paste this code into file test.php and running on the web browser with address name http://localhost/tes_mysql.php
View in Dreamweaver

Paste this under code into your Window application web design :

$host="localhost";
$user="root";
$pass="";
$db="test";
$tbl_name="table_tes";
$connect=mysql_connect($host,$user,$pass)or die(mysql_error());
$select_db=mysql_select_db($db,$connect);
if ($connect) {
print "Success Connected to Database test";
} else {
print "Error connection";
}
?>

$query="SELECT * FROM $tbl_name";
$result=mysql_query($query);
?>
 

   

   

   

   

   

 

 
 while ($row=mysql_fetch_array($result)) {
 ?>
 


   

   

   

   

   

 

 
  }
  ?>
ID First Name Last Name Email City

Step-5. Running on localhost typing addres http://localhost/tes_mysql.php on your web browser.

Penggunaan Variabel dan Data Visual Basic

Variable adalah suatu tempat di memory komputer yang mempunyai nama
dan digunakan sebagai tempat penyimpanan sementara suatu nilai.dalam penamaan suatu variabel perlu diperhatikan syarat-syarat yang sudah ditentukan oleh Visual BasicData adalah sekumpulan informasi yang disimpan kedalam memory dan kemudian diproses oleh komputer.Dalam pemrograman Visual Basic dikenal dengan Declarasi type data,biasanya data tersebut bersifat sementara.Tipe data dalam Visual Basic umumnya dibagi dua,yaitu :
Charakter dan Numerik.Walaw pada perkembangan selanjutnya dikembangkan
menjadi beberapa tipe.Contoh type data seperti Integer,Long,Singgle,Currency..

Download Selengkapnya File | Word | PDF | Project



Penggunaan Operator Visual Basic

Operator dalam pemrograman Visual Basic adalah biasanya diartikan sebagai simbol
yang digunakan untuk melakukan suatu operasi terhadap nilai data.Simbol operator biasanya berupa
karakter ataupun kata khusus.Terdapat tiga jenis operator dalam Visual Basic yaitu :
  • operator Operasi(Aritmatika) : yaitu operator yang digunakan untuk melakukan
    operasi matematis terhadap nilai data

  • Operator Perbanding : yaitu
    digunakan untuk operasi yang membandingkan nilai data.

  • Operator Logika : yaitu operator
    untuk operasi yang membandingkan suatu perbandingan

  • Download Selengkapnya File | Word | PDF
    | Project

    Mengambil Extensi Suatu File dengan Visual Basic

    Klik disini untuk Download Project
    Persiapan :
    Siapkan Kontrol-kontrol berikut ini :
    Object
    Name
    Property
    Value
    Textbox Text1 Text (kosong)
    Textbox Text2 Text (kosong)
    Textbox Text3 Text (kosong)
    Commanbutton Command1 Caption Cari File
    CommonDialog Commondialog1 - -
    Untuk menambahkan kontrol Commondialog terlebih dahulu dengan klik menu Project-Component-dan pada kotak dialog Components beri centang pada Microsoft Common Dialog Control 6.0 dan tekan Ok.


    Cara lain yaitu dengan menekan Ctl+T pada keyboard


  • Copykan kode berikut kedalam Form yang bersangkutan










  • Jalankan dengan menekan tombol Start atau tekan F5 pada Keyboard







  • Good Luck !!
    Melengkapi Isi Combobox di Visual Basic

    Agar Lebih Mudah Download saja di sini :
    Download Project

    Persiapan :
    Object
    Name Property Value
    Form
    Form1 Text -
    Combo1
    Combo1 Text -
    Combo2
    Combo2 Text -
    Combo3
    Combo3 Text -
    Combo4
    Combo4 Text -
    Combo5
    Combo5 Text -
    Copykan kode Ini kedalam Form



    Jalankan dengan Menekan F5 pada Keyboard
    Good Luck

    Assalamualaikum

    Assalamualaikum...
    Salam sejahtera untuk semua sahabat yang sudah setia pada blog ini
    salam sejahtera juga untuk semua teman-teman di STMIK Bina Bangsa Lhokseumawe

    The syntax for creating a table


    The syntax for creating a table is as follows:
    CREATE TABLE  (
           field1 datatype,
           field2 datatype,
           etc......
    );
    When splitting over multiple lines within the MySQL command line the continuation indictor(->) will be used.
    mysql>
    mysql> CREATE TABLE employee (
        ->     ID INT(2) auto_increment primary key,
        ->     First_name VARCHAR(20),
        ->     Last_name VARCHAR(30),
        ->     Start_date DATE,
        ->     Salary int(6),
        ->     city VARCHAR(20),
        ->     description VARCHAR(20)
        -> );
    Query OK, rows affected (0.03 sec)

    mysql>
    mysql> desc employee;
    +-------------+-------------+------+-----+---------+----------------+
    | Field       | Type        | Null | Key | Default | Extra          |
    +-------------+-------------+------+-----+---------+----------------+
    | ID          | int(2)      | NO   | PRI | NULL    | auto_increment |
    | First_name  | varchar(20) | YES  |     | NULL    |                |
    | Last_name   | varchar(30) | YES  |     | NULL    |                |
    | Start_date  | date        | YES  |     | NULL    |                |
    | Salary      | int(6)      | YES  |     | NULL    |                |
    | city        | varchar(20) | YES  |     | NULL    |                |
    | description | varchar(20) | YES  |     | NULL    |                |
    +-------------+-------------+------+-----+---------+----------------+
    rows in set (0.05 sec)

    mysql>
    mysql> drop table employee;
    Query OK, rows affected (0.00 sec)

    mysql>

    Making new control with in visual basic 6.0

    Open new project and prepare one command button . last type code of following at form.
    Public Function LoadControl(oForm As Object, _
    CtlType As String, CtlName As String, nTop As Double, nLeft As Double) As Object
    Dim oCtl As Object
    On Error Resume Next
    If IsObject(oForm.Controls) Then
    Set oCtl = oForm.Controls.Add(CtlType, CtlName)
    If Not oCtl Is Nothing Then Set LoadControl = oCtl
    oCtl.Top = nTop
    oCtl.Left = nLeft
    oCtl.Visible = True
    oCtl.Caption = "Label1"
    End If
    End Function

    Private Sub Command1_Click()
    LoadControl Form1, "vb.textbox", "text1", 100, 1000
    LoadControl Form1, "VB.CommandButton", "Tombol", 1000, 1000
    LoadControl Form1, "vb.Combobox", "cmb1", 2200, 1000
    End Sub
    Press F5 to running program

    Make Form Transparan With VB 6.0


    To make visual transparent Form in Visual basic 6.0 opening new project and enhance a modul.modul can be enhanced by click of project add module . typing code  following into module.
    Private Declare Function SetLayeredWindowAttributes Lib "user32" _
    (ByVal hwnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, _
    ByVal dwFlags As Long) As Long

    Private Declare Function UpdateLayeredWindow Lib "user32" _
    (ByVal hwnd As Long, ByVal hDCDst As Long, pptDst As Any, _
    psize As Any, ByVal hDCSrc As Long, pptSrc As Any, crKey As Long, _
    ByVal pblend As Long, ByVal dwFlags As Long) As Long

    Private Declare Function GetWindowLong Lib "user32" Alias _
    "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long

    Private Declare Function SetWindowLong Lib "user32" Alias _
    "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, _
    ByVal dwNewLong As Long) As Long

    Private Const GWL_EXSTYLE = (-20)
    Private Const LWA_COLORKEY = &H1
    Private Const LWA_ALPHA = &H2
    Private Const ULW_COLORKEY = &H1
    Private Const ULW_ALPHA = &H2
    Private Const ULW_OPAQUE = &H4
    Private Const WS_EX_LAYERED = &H80000

    Public Function MakeTransparent(ByVal hwnd As Long, Perc As Integer) As Long
    Dim Msg As Long
    On Error Resume Next
    If Perc < 0 Or Perc > 255 Then
    MakeTransparent = 1
    Else
    Msg = GetWindowLong(hwnd, GWL_EXSTYLE)
    Msg = Msg Or WS_EX_LAYERED
    SetWindowLong hwnd, GWL_EXSTYLE, Msg
    SetLayeredWindowAttributes hwnd, 0, Perc, LWA_ALPHA
    MakeTransparent = 0
    End If
    If Err Then
    MakeTransparent = 2
    End If
    End Function

    ''==========
    After code in module have been typed later;then type code of following at form in Event load.
    Private sub Form_load()
    MakeTransparent Me.hwnd, 150
    ‘150 è can be altered - alter.
    End sub
    Running form by pressing F5
    Result it like picture following.Ubah form transparan
     

    Popular Posts