Jump to content
TonikCapGajah2013

Tutorial Dreamweaver 8 (php&mysql)

Recommended Posts

ok... ko check satu persatu

1. Server Apache ko boleh guna apa saja pakej spt EasyPHP, Xampp dll.

yang penting Apache dan mySQL boleh jalan.

2. Database buat dalam phpmyadmin (maklumat database kenalah jelas)

3. Dalam Dreamweaver cuba buat 1 lagi site define yang baru.

Jangan takut nak cuba.

> Guna Remote Server

> Buat 2 folder (dw8local dan dw8remote)

4. Cuba buat connection semula.

OK.

====================

> Site name = dw8x

> Server Technology > Yes > PHPmySQL

> How to work during development > Edit Localy, then upload to testing server

> Where do you want to store your files > path to dw8local folder

> How do you connect to testing server > Local/Network

> Folder untuk test > path to dw8remote folder

> URL > http://localhost/dw8remote

atau http://localhost

> enable checking > no

> Summary > Done

thankz a lot... nanti pape hal aku tye ko balik.

aku tak leh nak test lagi skg ni.. :rolleyes:

Share this post


Link to post
Share on other sites

try jangan tak try :D

LATIHAN DATABASE ... sambungan dari atas.

DELETE DATA-2

Fail confirmdel.php

=================================

Inilah bentuk fail confirmdel.php yang perlu dibuat.

957817del2-1.jpg

Rajah 1: Fail Confirm Delete (confirmdel.php)

1. Insert Form

Insert > Form > Form

2. Tambah hidden field ke dalam form

Klik dalam form kemudian Insert > Form > Hidden Field

Klik ikon hidden field > Properties > tukar nama kepada hidden1

3. Buat Table dan masukkan maklumat seperti dalam Rajah 1.

4. Binding Recordset.

Application > Binding > + > Recordset

569681del2-2.jpg

Rajah 2:

5. Binding Recordset ke hidden field

Ikut step seperti dalam rajah 3.

  • 1. klik ikon hidden
  • 2. klik ikon 'lightning bolt'
  • 3. dalam dynamic data > klik id
  • 4, klik OK.
361033del2-3.jpg

Rajah 3: Binding hidden field

Akhir sekali tambah logic untuk delete rekod.

>Application > Server Behaviour > Recordset atau

Window > Server Behaviors

> klik + > Delete Record

> simpan fail.

797471del2-4.jpg

Rajah 4: Delete rekod

Cara nak uji:

1. preview fail deldata.php

2. klik Delete (kolum terakhir)

3. masuk ke fail confirmdel.php

4. klik butang Delete Record

ok.

==============

akan bersambung ke Edit Data / Edit Record

Edited by PowerRootTongkatAli_GS

Share this post


Link to post
Share on other sites

x jadi gak la pro…

emm,

Guna Remote Server

> Buat 2 folder (dw8local dan dw8remote)

aku x faham step ni nak wak camne…kene wujudkan dulu ke folder ni? tapi aku try jgk la. Aku x wujudkan pun.

Jadi aku start dari define site baru terus..mcam ko ajar la yang dibawah ni.

Site name = dw8x ---> ok

> Server Technology > Yes > PHPmySQL -->ok

> How to work during development > Edit Localy, then upload to testing server -->ok

> Where do you want to store your files > path to dw8local folder

C:\Documents and Settings\user\My Documents\dw8x\dw8xlocal\ -> betulkan jadi camni??

> How do you connect to testing server > Local/Network

-> ok,pastu ada where do you copy your files to in order to test them kan?? Kat cini nak tulis ape? Ke yang ni maksud ko? Folder untuk test > path to dw8remote folder. Jadi type dw8remote je kan??

Kene √ tak kat refresh remote file list automatically tu??

> Folder untuk test > path to dw8remote folder

> URL > http://localhost/dw8remote

atau http://localhost

---> pastu sampai kat sini kalu buat http://localhost je,okk.. URL prefix was successful. Tapi kan bila aku taip camni plak http://localhost/dw8remote . kuar msg...

‘Dreamweaver cannot use the prefix you entered to display live data. Please double ckeck your site configuration or click your site on Help for more information on how to correct this problem. [HTTP Error:404]’

> enable checking > no

> Summary > Done

pro…tolong la jawab semua persoalan aku ni..dah banyak kali aku try tau… Tapi tak dapat2 jgk ni.. aku harap ko fham soalan2 yang aku berikan dan situasi yang aku hadapi…

nanti pas aku bleh buat database ni,banyak lagi yang aku nak buat ni…nanti nak kene design plak..walaupun aku buta nak gune dreamwaver camne tp aku nak usaha jgk gunakannya.. :P

Edited by sYah_Is

Share this post


Link to post
Share on other sites

ikut step:

buat dulu 2 folder tu. (dw8local dan dw8remote)

bila dah ada 2 folder baru bukak DW8 > Define Site.

-> ok,pastu ada where do you copy your files to in order to test them kan?? Kat cini nak tulis ape? Ke yang ni maksud ko? Folder untuk test > path to dw8remote folder. Jadi type dw8remote je kan??

Kene √ tak kat refresh remote file list automatically tu??

kena browse dan cari folder dw8remote untuk dapatkan full path (cth: C:\............ \dw8remote)

URL : cuba masukkan http://localhost/dw8remote

yang refresh tu tick

pastu sampai kat sini kalu buat http://localhost je,okk.. URL prefix was successful. Tapi kan bila aku taip camni plak http://localhost/dw8remote . kuar msg...

‘Dreamweaver cannot use the prefix you entered to display live data. Please double ckeck your site configuration or click your site on Help for more information on how to correct this problem. [HTTP Error:404]’

Yang nie sebab ko tak buat folder dw8remote. buat dulu folder nie.

Kaedah dia macam nie:

Folder dw8local untuk simpan fail yang dibuat dalam Dreamweaver.

Folder dw8remote untuk preview dalam web browser

Sebelum preview kena upload dulu semua fail yg ada dalam folder dw8local ke folder dw8remote.

Dalam Dreamweaver ada ikon untuk upload fail. (ko perhati sebelah kanan bawah section File ada anak panah tunjuk ke atas)

Cuba buat sampai berjaya (kalau nak follow la :D)

Share this post


Link to post
Share on other sites

LATIHAN DATABASE ... sambungan dari atas.

VIEW DATA

Guna fail viewdata.php (buka fail viewdata.php untuk edit)

> Klik Application > Binding > + > Recordset

Lihat rajah 1

224768dwdb=10.jpg

Rajah 1: Create Recordset

Masukkan maklumat seperti dalam rajah 2

476231dwdb=11.jpg

Rajah 2:

> Tukar kepada Common > Table

> Masukkan maklumat Table

582510dwdb=12.jpg

Rajah 3: Create Table

> Masukkan label dalam ROW 1 (ID, Product ... Price)

> Klik, tarik dan letak recordset dalam jadual (drag & drop)

> penuhkan jadual dengan recordset yang sesuai.

501647dwdb=13.jpg

Rajah 4: Binding Recordset

> Highlight ROW2

> Server Behaviour > + > Repeat Region

> Show 10 rekod atau berapa bilangan yang ingin ditunjukkan terpulang kepada anda.

726187dwdb=14.jpg

Rajah 5: Repeat Region

PREVIEW dalam web browser

> Simpan fail viewdata.php

> Tekan kekunci F12

OK.

bwh HIGHLIGHT ROW...sblm PREVIEW....Sy xdpt nk bt mcm powerroot ajar....mslh>>under description...price...kene type rsStoredescription....rsStorePrice....atau otomatik klua slps kita buat step HIGHLIGHT ROW 2...sy tak dpt, w-pun dh preview kt browser( slps tkn F12) x muncul rsStore...bla...bla......

sm jg mslh dlm latihan database DELETE...nk linkkan delete kat confirmdelete.php.....tak tau caranya....

Share this post


Link to post
Share on other sites

dia tak jadi dengan sendiri. kena bind.

cara dia, klik recordset price kemudian heret (drag) ke dalam petak price row2

kemudian lepaskan. ok.

yang highlight row 2 adalah untuk repeat region. supaya table akan display semua rekod

atau jumlah rekod yang kita tetapkan , bila kita preview nanti (guna kekunci F12)

try...

nak link ke fail confirmdel.php

1. buat dulu fail confirmdel.php (biarkan kosong dili)

2. dalam fail deldata.php > highlight perkataan Delete kemudian tengok Properties Panel kat bawah.

3. Cari Link dan taip dalam petak confirmdel.php > tekan Enter.

4. Siap

Edited by PowerRootTongkatAli_GS

Share this post


Link to post
Share on other sites

PINDA REKOD (Update Record)

Fail yang terlibat > editdata.php

Klik 2 kali fail editdata.php untuk membuat langkah seterusnya.

Dalam fail editdata.php;

1. Buat 1 Table (2 row, 5 colum)

Masukkan label dalam row 1 (ID, CategoryID ----- Price)

2. Buat Recordset.

Bind Recordset ke dalam Table dalam row 2

3. Buat Repeat Region (highlight row 2)

4. Buat link ke fail confirmupdate.php

Save fail editdata.php

809604dw8-5.jpg

Rajah 1: Fail editdata.php

=====================

Fail confirmupdate.php

Recordset

1. Buatkan fail confirmupdate.php dan buka untuk edit.

2. Buat recordset (Window > Bindings), klik (+) dan pilih Recordset.

3. Dalam tetingkap Recordset;

Name: rsUpdate

Connection: connStore

Table: tblestore

Column: All

Filter: id dan =

URL Parameter: recordID

Sort: None

OK

Masih lagi dalam fail confirmupdate.php

Update Server Behaviors

1. Guna Application bar (sebelah atas)

2. Klik Update form wizard

3. Connection: connStore

4. Table to update: tblestore

5. Select record from: reStore

6. Unique key: id

7. After updating: index.php

8. OK.

Edited by PowerRootTongkatAli_GS

Share this post


Link to post
Share on other sites

PINDA REKOD (Update Record)

Cara Uji:

1. Buka fail editdata.php

2. Tekan F12 untuk buka dalam browser.

3. Klik Link ID untuk buka fail confirmupdate.php

Cuba tengok adakah rekod yang kita klik tu masuk ke dalam form dengan ID yang betul. Kalau betul, buat pindaan dan klik butang Update Record.

Fail index.php akan dipaparkan.

478384dw8-update1.jpg

Dalam fail index.php klik View Data.

OK.

Edited by PowerRootTongkatAli_GS

Share this post


Link to post
Share on other sites

LATIHAN DATABASE ... sambungan dari atas.

DELETE DATA

> Buatkan 1 fail deldata.php

> Edit fail deldata.php (klik 2 kali fail)

> Binding > Recordset dan masukkan maklumat seperti rajah 1.

833475dw-del.jpg

Rajah 1: Recordset

> buatkan Table dan isi maklumat seperti dalam rajah 2

404713dw-del1.jpg

Rajah 2: Table dan Repeat Region

602804dw-del0.jpg

Rajah 3:

> Pinda Code

> Klik pada perkataan Delete

> Klik Code

> Tambah code seperti dalam rajah 4

397691dw-del2.jpg

Rajah 4: Tambah Code

Dan akhir sekali preview fail deldata (tekan kekunci F12)

Apabila anda klik Delete, rekod dalam row yang berkaitan akan dihantar ke satu fail lain yang dinamakan confirmdel.php

Cipta fail confirmdel.php

bersambung di muka 2

tentang tambah code tu, kod apa yg perlu ditambah?

Share this post


Link to post
Share on other sites

Alhmdullilah…dah dapat pn define site 2.. test URL pn success…

Pas2 aku ikut step yang seterusnya..

Em,aku de problem kat sini plak pro.pas siap wak database kat phpmyadmin 2,siap dengan user n password dah. Tp lpas isi semua, aku nak select database tetap tak dapat gak… kenapa ek????? Error dia cam ari 2 jgk..yang ni.

" 1)there is no testing server running on the server machine.

2) the testing server specified for this site does not map the http://localhost/_mmserverscripts/MMHTTPDB.php URL. verify that the URL Prefix maps to the root of the site."

KENAPA EKK?? :blush::huh:

Share this post


Link to post
Share on other sites

ko dah run apache kan.. ok.

ok sekarang ko kat stage mane

Folder:

ada dua folder kan? folder letak kat mana.

Edited by PowerRootTongkatAli_GS

Share this post


Link to post
Share on other sites

SEARCH DATA

(Nak cari data atau rekod dalam database)

Macam biasa run Apache & mySQL. Buka Dreamweaver (site DW8)

Buat 2 fail;

1. finddata.php

2. searchresult.php

Buka fail finddata.php untuk edit.

Fail finddata.php

1. Buatkan 1 Form.

(Menu Insert > Form > Form) atau

(Form Toolbar > Form)

2. Biarkan kursor berada di dalam Form kemudian insert Text Field

(Insert > Form > Text Field > OK)

Katalah kita nak cari komponen komputer (product)

Klik Text Field, tengok bahagian bawah skrin , Properties.

Tukar nama textfield --> product.

3. Buat satu button Submit selepas Text Field di dalam Form.

(Insert > Form > Button > OK)

4. Apabila kita tekan Submit data kan dihantar ke fail searchresult.php

Buat link ke fail searchresult.php

Klik butang Submit, lihat bahagian bawah skrin;

<body><form#form1><label>

klik <form#form1>

Dalam petak Action taip: searchresult.php <enter>

Simpan fail.

============================

FAIL SEARCH RESULT

Buka fail searchresult.php untuk edit dan buat resordset.

Application > Binding > + > Recordset

Masukkan seperti dalam rajah 1.

888937dw-sch1.jpg

Rajah 1: Recordset

Langkah seterusnya, membuat Table untuk tunjuk result.

792907dw-sch2.jpg

Rajah 2:Search Result Page.

Petunjuk Rajah 2;

1. Table

2. Recordset

3. Bind recordset ke dalam Table

4. Repeat Region.

Simpan fail.

=====================

Cara nak uji.

Buka fail finddata.php > Tekan F12 > taip namaproduct > Submit.

OK.

akan bersambung ke Login Page dan Restricted Page (untuk Admin)

Edited by PowerRootTongkatAli_GS

Share this post


Link to post
Share on other sites

LOGIN PAGE

Dalam peringkat ini kerja-kerja yang terlibat ialah;

1. Menetapkan page yang hanya boleh dilihat oleh member dan admin sahaja.

2. Menetapkan page yang boleh dilihat umum

3. Menetapkan page yang berkaitan dengan administration

Contoh;

1. Fail2 yang melibatkan pindaan, tambahan dan padam hanya boleh dilakukan oleh admin sahaja.

Fail-Fail Yang Perlu;

1. Fail untuk daftar sebagai ahli

2. Fail untuk login

3. Fail respon (daftar dan login)

Database:

Tambah 1 Table yang mengandungi rekod ahli dan password.

Edited by PowerRootTongkatAli_GS

Share this post


Link to post
Share on other sites

Restricted Page

(Fail yang hanya admin/ahli sahaja boleh lihat)

Untuk Admin sahaja

1. Fail Add Data

2. Fail Update Data

3. Fail Delete Data

Untuk Ahli:

Fail senarai ahli berdaftar boleh dilihat oleh ahli/admin

tetapi tidak dapat dilihat oleh umum (public)

Edited by PowerRootTongkatAli_GS

Share this post


Link to post
Share on other sites

pd kiriman 27....

dalam fail confirmdel.php> saya tak dpt word delete record appear kt browser...pastu bila sy klik delete dihujung kolum...akan klua table yg diisi tanpa word delete record dan klua warning sprti di bwh ini.....

Warning: mysql_free_result(): 5 is not a valid MySQL result resource in C:\xampp\htdocs\dw8.1\confirmdel.php on line 105

blh selesai tak?

Share this post


Link to post
Share on other sites

Fail deldata.php

ada kaitan dengan fail confirmdel.php

1. Cuba check balik fail deldata.php.

dan kod tambahan yang diletakkan pada perkataan delete

Perkataan delete dilinkkan ke fail confirmdel.php apabila diklik.

Apabila preview kita boleh klik pada perkataan delete dan akan bukak fail

confirmdel.php

Apabila browser membuka fail confirmdel.php, maklumat dari fail deldata.php akan dimasukkan secara betul.

Pastikan semua nie tidak ada masalah.

Fail deldata.php apabila di preview:

483997deldata1.gif

Cuba tengok link yang dihubungkan pada perkataan Delete. Sepatutnya begini;

http://localhost/dw8/confirmdel.php?recordID=3

dan bukannya;

http://localhost/dw8/confirmdel.php

Ini bergantung kepada kod yang kita tambah selepas URL.

Kod:

<a href="confirmdel.php?recordID=<?php echo $row_Recordset1['id']; ?> ">Delete</a>

Fail confirmdel.php apabila link Delete diklik

58719deldata2.gif

==============

Fail confirmdel.php

Penggunaan Hidden Field

1. Supaya rekod tidak ditunjukkan. Biasanya nilai auto increment dan status primary key.

2. Salah satu kaedah untuk Form Variable dan operasi Logic. (delete/update)

Edited by PowerRootTongkatAli_GS

Share this post


Link to post
Share on other sites

ko dah run apache kan.. ok.

ok sekarang ko kat stage mane

Folder:

ada dua folder kan? folder letak kat mana.

aku letak dalam D,local n remote...tp dlam apache > htdoc aku dah letak satu,remote. database aku dah buat kat phpmyadmin. tapi masa nak select database kat dalam dmweaver 2 yang tak dapat. pro,ko tolong aku ye?? balas secepat mungkin.

(aku nk wak projek akhir ni. skarang ni aku tengah risau ni nak wak guna software yg mane.kalu dah dapt wak database kat dmweaver, baru lah boleh nak terus gunakan software ni.nanti tak nak la,dah design separuh jlan,pas2 terpaksa berpatah balik guna maguma 2...mati la..huhu)

Edited by sYah_Is

Share this post


Link to post
Share on other sites

kalau ko follow dengan serious tak jadi masalah.

Kena check semula Site Definition;

Guna remote folder yang ada dalam htdocs

dan local folder yang ada dalam D:

(yang awak dah buat .... kan)

Contoh:

folder remote dalam htdocs ---> testremote

folder local dalam D: ---> testlocal

Edit Site Definition sediada atau buat baru.

Name: TEST

Address: http://localhost/testremote

Server: PHP&MySQL

Edit Locally and then upload to remote server

Store file: D:\testlocal\

Connect: Local/Network

Folder on server: C:\xampp\htdocs\testremote\

Test URL: http://localhost/testremote

No Check

Done.

============

Try Connect Database.

Edited by PowerRootTongkatAli_GS

Share this post


Link to post
Share on other sites

Power root…huhuhu..camne ni,still ada error la..aku cuba sedaya upaya tau? Serious ni aku buat. Skrang problem aku tetap kat nak select database kat dlm dreamweaver ni..

kenapa ni pro??? Ke cara aku buat user name n password 2 yang salah? Biar aku tunjuk step by step ape yang aku buat.Kalu yang aku punya 2 camni tau.

MySQL

Create new database [Documentation]

Show MySQL runtime information [Documentation]

Show MySQL system variables [Documentation]

Show processes [Documentation]

Reload MySQL [Documentation]

Users [Documentation]

Databases statistics

phpMyAdmin

Language:

phpMyAdmin documentation

Show PHP information

Official phpMyAdmin Homepage

Sourceforge phpMyAdmin Download Page

[ChangeLog] [CVS] [Lists]

So,aku pun buat la user name n password kat users 2... pastu jadi la camni.cthnya:

Any host - Any user

Note: MySQL privilege names are expressed in English

Action Host User Password Privileges

Edit

Delete

Grants

% Any No No Privileges

Edit

Delete

Grants

% root No Select Insert Update Delete Create Drop Reload Shutdown Process File Grant References Index Alter

Edit

Delete

Grants

localhost Any No Grant

Edit

Delete

Grants

localhost root No Select Insert Update Delete Create Drop Reload Shutdown Process File Grant References Index Alter

________________________________________

• Reload MySQL [Documentation]

•

Check Database Privileges

Database :

•

Add a new User

Any host

Host :

Any user

User name :

No Password

Password :

Re-type :

Privileges :

Select

Insert

Update

Delete

Create

Drop

Reload

Shutdown

Process

File

Grant

References

Index

Alter

Check All Uncheck All

aku pun click go. Dan ni la resultnya.

Host localhost - User daun

You have added a new user.

Remember reload the server.

SQL-query :

INSERT INTO mysql.user SET Host = 'localhost', User = 'daun', Password = PASSWORD('12345'), Select_priv = 'Y', Insert_priv = 'Y', Update_priv = 'Y', Delete_priv = 'Y', Create_priv = 'Y', Drop_priv = 'Y', Reload_priv = 'Y', Shutdown_priv = 'Y', Process_priv = 'Y', File_priv = 'Y', Grant_priv = 'Y', References_priv = 'Y', Index_priv = 'Y', Alter_priv = 'Y'

Note: MySQL privilege names are expressed in English

Action Host User Password Privileges

Edit

Delete

Grants

% Any No No Privileges

Edit

Delete

Grants

% root No Select Insert Update Delete Create Drop Reload Shutdown Process File Grant References Index Alter

Edit

Delete

Grants

localhost Any No Grant

Edit

Delete

Grants

localhost daun Yes Select Insert Update Delete Create Drop Reload Shutdown Process File Grant References Index Alter

Edit

Delete

Grants

localhost root No Select Insert Update Delete Create Drop Reload Shutdown Process File Grant References Index Alter

________________________________________

ok,camne pendapat ko yang aku wak ni?? Ade problem x setakat ni??? Pas siap ni semua aku pun isi la kat dmweaver plak.

Connection name: saya

Mysql server : localhost

User name: daun

Password:*****

Database:

Tapi ade error yang cmni kuar bila aku klik select 2..

1045 Access denied for user:â€daun@localhost†(using password:YES)

AKU X TAHU SALAH KAT ANE….HELP MEEEEE!!!!!

Edited by sYah_Is

Share this post


Link to post
Share on other sites

pro,yang 2 aku just tunjuk kat ko macam mane aku buat user name n password je.aku tak tunjuk database n table yang aku dah buat 2.

Emm..pro, aku nak taye sikit ni. Ni bukan pasal database la..nanti aku continue balik database. thanks a lot bg tutorial video 2..

ape ek beza basic page dgn dynamic page kat file>new 2?em..kalu nak wak program web gune php kat basic page boleh x?? atau gune kat ane??

pastu kan,satu lagi aku nak taye pro ni. boleh tak ko tunjukkan sikit coding gune php nak buat form kat dalam dreamweaver ni? cntoh ko buat la nama n no i/c seturusnya ada button nak submit ke database.php tau.please....!

Edited by sYah_Is

Share this post


Link to post
Share on other sites

Basic Page tu nak buat fail html dll spt dalam senarai tu.

Fail html tak perlu pun server kalau nak tengok, guna browser dah cukup.

Bila tak guna server page tu akan 'kaku' boleh baca sahaja.

Melainkan kalau campur dgn skrip lain spt javascript.

Dynamic Page nak buat fail spt PHP, ASP dll

Fail nie kena guna web server baru boleh run.

Boleh sambung ke database. Bila dah boleh sambung ke DB

maka fail nie jadi dinamik, ada respon, dsb.

Jadi, kalau nak buat page yang dinamik, guna menu Dynamic Page.

Cara lain nak buat page, klik kanan dalam rungan SITE > New File

Taip nama fail yang kita nak buat : test.php --> jadi dinamik.

Kalau taip --> test.html jadi statik

ok.

***********************

Fail Form

<html>

<body>

<form action="test.php" method="post">

Nama: <input type="text" name="nama" /> <br />

No KP: <input type="text" name="nokp" /> <br />

<input type="submit" value="Hantar"/>

</form>

</body>

</html>

Fail Test.php

<html>

<body>

Selamat datang <?php echo $_POST["nama"]; ?>.<br />

No KP anda ialah: <?php echo $_POST["nokp"]; ?>.

</body>

</html>

Macam tu ker?

****************

Tentang coding nak sambung ke database, kalau ko follow tutorial nie dengan betul, boleh tengok coding dia dalam Dreamweaver juga.

Klik jer Tab Code.

ok.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...