Skip to main content

PHP–Projek ROSES

1. config.php

<?php
//database configuration info
$db=mysqli_connect("localhost","root","abc123","roses");
if($db==false){
echo "DB connect error: ";
echo mysqli_connect_error($db);
}else{
//echo "Database connected";
}

?>


 


2: senarairekod.php


image



<?php
//paparan semua rekod
include "config.php";
?>
<html>
<head>
<title>Roses: Laporan</title>
</head>
<body>
Senarai semua rekod dalam jadual Daftar<br>
<?php
//sql command to fectch all records
$sql="SELECT id , namapertubuhan , alamat ,
poskod , negeri FROM daftar"
;
//send sql command to db server
$rs=mysqli_query($db, $sql);
//display sql error
if($rs==false){
echo mysqli_error($db);
}
//identify number of records
$bilrekod=mysqli_num_rows($rs);
if($bilrekod==0){
echo "Tiada rekod diperolehi";
}
else{//rekod ada, boleh papar
?>
<table width="90%" border="1">
<tr align="center">
<td>id</td>
<td>Nama pertubuhan</td>
<td>Alamat</td>
<td>Poskod</td>
<td>Negeri</td>
</tr>
<?php
while($rekod=mysqli_fetch_array($rs)){
?>
<tr>
<td><?=$rekod['id']?></td>
<td><?=$rekod['namapertubuhan']?></td>
<td><?=$rekod['alamat']?></td>
<td><?=$rekod['poskod']?></td>
<td><?=$rekod['negeri']?></td>
</tr>
<?php
}
?>
</table>
<?php
}
?>
</body>
</html>





3. carian.php


image


<?php
//paparan semua rekod
include "config.php";
?>
<html>
<head>
<title>Roses: Carian</title>
</head>
<body>
Cari nama Pertubuhan<br>

<form action="" method="get" name="formsearch">
Enter a name <input name="txtsearch" type="text">
<input name="btnsearch" type="submit" value="Cari">
</form>
<?php
$carian=$_GET['txtsearch'];
echo "Carian untuk: $carian <br>";
//sql command to fetch all records
$sql="SELECT id , namapertubuhan , alamat ,
poskod , negeri FROM daftar
WHERE namapertubuhan LIKE '%$carian%' "
;
//send sql command to db server
$rs=mysqli_query($db, $sql);
//display sql error
if($rs==false){
echo mysqli_error($db);
}
//identify number of records
$bilrekod=mysqli_num_rows($rs);
if($bilrekod==0){
echo "Tiada rekod diperolehi";
}
else{//rekod ada, boleh papar
?>
<table width="90%" border="1">
<tr align="center">
<td>id</td>
<td>Nama pertubuhan</td>
<td>Alamat</td>
<td>Poskod</td>
<td>Negeri</td>
</tr>
<?php
while($rekod=mysqli_fetch_array($rs)){
?>
<tr>
<td><?=$rekod['id']?></td>
<td><?=$rekod['namapertubuhan']?></td>
<td><?=$rekod['alamat']?></td>
<td><?=$rekod['poskod']?></td>
<td><?=$rekod['negeri']?></td>
</tr>
<?php
}
?>
</table>
<?php
}
?>
</body>
</html>





4. carian-nama-tahun.php


image


<?php
//paparan semua rekod
include "config.php";
?>
<html>
<head>
<title>Roses: Carian</title>
</head>
<body>
Cari nama Pertubuhan<br>

<form action="" method="get" name="formsearch">
Nama pertubuhan <input name="txtsearch" type="text"
value="<?php echo $_GET['txtsearch'] ?>">
Tahun didaftar <input name="txttahun" type="text"
value="<?php echo $_GET['txttahun'] ?>"
maxlength=4>
<input name="btnsearch" type="submit" value="Cari">
</form>
<?php
$carian=$_GET['txtsearch'];
$tahun=$_GET['txttahun'];
echo "Carian untuk pertubuhan: $carian <br>";
echo "Tahun didaftar: $tahun <br>";
//sql command to fetch all records
$sql="SELECT id , namapertubuhan , alamat ,
poskod , negeri, masadaftar FROM daftar
WHERE namapertubuhan LIKE '%$carian%'
AND year(masadaftar)='$tahun'"
;
//send sql command to db server
$rs=mysqli_query($db, $sql);
//display sql error
if($rs==false){
echo mysqli_error($db);
}
//identify number of records
$bilrekod=mysqli_num_rows($rs);
if($bilrekod==0){
echo "Tiada rekod diperolehi";
}
else{//rekod ada, boleh papar
?>
<table width="90%" border="1">
<tr align="center">
<td>id</td>
<td>Nama pertubuhan</td>
<td>Alamat</td>
<td>Poskod</td>
<td>Negeri</td>
<td>Tarikh daftar</td>
</tr>
<?php
while($rekod=mysqli_fetch_array($rs)){
?>
<tr>
<td><?=$rekod['id']?></td>
<td><?=$rekod['namapertubuhan']?></td>
<td><?=$rekod['alamat']?></td>
<td><?=$rekod['poskod']?></td>
<td><?=$rekod['negeri']?></td>
<td><?=$rekod['masadaftar']?></td>
</tr>
<?php
}
?>
</table>
<?php
}
?>
</body>
</html>




 

 

5. insert.php

 

image

<?php
//paparan semua rekod
include "config.php";
?>
<html>
<head>
<title>Roses: Masuk rekod baru</title>
</head>
<body>
Cari nama Pertubuhan<br>

<form action="" method="get" name="forminsert">
Nama pertubuhan <input name="txtnama" type="text"><br>
Alamat <input name="txtalamat" type="text"><br>
Poskod <input name="txtposkod" type="text" maxlength=5><br>
Negeri
<select name="txtnegeri">
<?php
$rsn=mysqli_query($db, "SELECT * FROM negeri");
while($recn=mysqli_fetch_array($rsn)){
echo "<option value=".$recn['kodnegeri'].">".
$recn['keterangan']."</option>";
}
?>
</select>
<br>
No Telefon <input name="txttelefon" type="text"><br>
Emel <input name="txtemel" type="text"><br>
Nama Setiausaha <input name="txtnamasu" type="text"><br>
No KP Setiausaha <input name="txticsu" type="text"><br>

<input name="btninsert" type="submit" value="Simpan">
</form>
<?php
$nama=$_GET["txtnama"];
$alamat=$_GET["txtalamat"];
$poskod=$_GET["txtposkod"];
$negeri=$_GET["txtnegeri"];
$telefon=$_GET["txttelefon"];
$emel=$_GET["txtemel"];
$namasu=$_GET["txtnamasu"];
$icsu=$_GET["txticsu"];
if ($nama!=null){//pastikan user dah masukkan data
//sql utk masukkan rekod baru dlm db
$sql="INSERT INTO daftar
values
('','$nama','$alamat','$poskod','$negeri',
'$telefon','$emel','$namasu','$icsu','')"
;
$rs=mysqli_query($db, $sql);
if($rs==false){
echo "Error in sql:".mysqli_error($db);
echo "Full sql: $sql";
}else{
echo "Nama pertubuhan: $nama<br>";
echo "Alamat: $alamat, $poskod, $negeri<br>";
echo "Rekod berjaya disimpan<br>";
}
}//if not null
?>
</body>
</html>





6. listedit.php

 

image

<?php
//paparan semua rekod
include "config.php";
?>
<html>
<head>
<title>Roses: Senarai utk Edit</title>
</head>
<body>
Cari nama Pertubuhan<br>

<form action="" method="get" name="formsearch">
Enter a name <input name="txtsearch" type="text">
<input name="btnsearch" type="submit" value="Cari">
</form>
<?php
$carian=$_GET['txtsearch'];
echo "Carian untuk: $carian <br>";
//sql command to fetch all records
$sql="SELECT id , namapertubuhan , alamat ,
poskod , negeri FROM daftar
WHERE namapertubuhan LIKE '%$carian%' "
;
//send sql command to db server
$rs=mysqli_query($db, $sql);
//display sql error
if($rs==false){
echo mysqli_error($db);
}
//identify number of records
$bilrekod=mysqli_num_rows($rs);
if($bilrekod==0){
echo "Tiada rekod diperolehi";
}
else{//rekod ada, boleh papar
?>
<table width="90%" border="1">
<tr align="center">
<td> </td>
<td>id</td>
<td>Nama pertubuhan</td>
<td>Alamat</td>
<td>Poskod</td>
<td>Negeri</td>
</tr>
<?php
while($rekod=mysqli_fetch_array($rs)){
$id=$rekod['id'];
?>
<tr>
<td><a href="edit.php?id=<?php echo $id?>">
edit</a></td>
<td><a href="hapus.php?id=<?php echo $id?>">
hapus</a></td>
<td><?php echo $rekod['id']?></td>
<td><?php echo $rekod['namapertubuhan']?></td>
<td><?php echo $rekod['alamat']?></td>
<td><?php echo $rekod['poskod']?></td>
<td><?php echo $rekod['negeri']?></td>
</tr>
<?php
}
?>
</table>
<?php
}
?>
</body>
</html>




 

 

7. edit.php

image


<?php
//paparan semua rekod
include "config.php";
$id=$_GET['id'];
$sqle="SELECT * FROM daftar WHERE id='$id'";
$rse=mysqli_query($db, $sqle);
$re=mysqli_fetch_array($rse);
$nama=$re['namapertubuhan'];
$alamat=$re['alamat'];
$poskod=$re['poskod'];
$negeri=$re['negeri'];
$telefon=$re['telefon'];
$email=$re['email'];
$namasu=$re['namasu'];
$icsu=$re['icsu'];
?>
<html>
<head>
<title>Roses: Edit rekod lama</title>
</head>
<body>
Edit Pertubuhan<br>

<form action="simpan.php" method="get" name="forminsert">
ID <input name="txtid" type="text"
value="<?php echo $id ?>"><br>
Nama pertubuhan <input name="txtnama" type="text"
value="<?php echo $nama ?>"><br>
Alamat <input name="txtalamat" type="text"
value="<?php echo $alamat ?>"><br>
Poskod <input name="txtposkod" type="text" maxlength=5
value="<?php echo $poskod ?>"><br>
Negeri <?php echo $negeri ?>
<select name="txtnegeri">
<?php
$rsn=mysqli_query($db, "SELECT * FROM negeri");
while($recn=mysqli_fetch_array($rsn)){
if($recn['kodnegeri']==$negeri){
echo "<option value=".$recn['kodnegeri']." selected >".
$recn['keterangan']."</option>\n";
}else{
echo "<option value=".$recn['kodnegeri']." >".
$recn['keterangan']."</option>\n";
}
}
?>
</select>
<br>
No Telefon <input name="txttelefon" type="text"
value="<?php echo $telefon ?>"><br>
Emel <input name="txtemel" type="text"
value="<?php echo $email ?>"><br>
Nama Setiausaha <input name="txtnamasu" type="text"
value="<?php echo $namasu ?>"><br>
No KP Setiausaha <input name="txticsu" type="text"
value="<?php echo $icsu ?>"><br>

<input name="btninsert" type="submit" value="Simpan">
</form>

</body>
</html>







0. Database


-- phpMyAdmin SQL Dump
-- version 2.11.1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Oct 13, 2011 at 03:58 AM
-- Server version: 5.0.45
-- PHP Version: 5.2.4

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";

--
-- Database: `roses`
--
CREATE DATABASE `roses` DEFAULT CHARACTER SET latin1 COLLATE latin1_general_ci;
USE `roses`;

-- --------------------------------------------------------

--
-- Table structure for table `daftar`
--
CREATE TABLE `daftar` (
`id` int(11) NOT NULL auto_increment,
`namapertubuhan` varchar(100) collate latin1_general_ci NOT NULL,
`alamat` varchar(100) collate latin1_general_ci NOT NULL,
`poskod` varchar(5) collate latin1_general_ci NOT NULL,
`negeri` varchar(2) collate latin1_general_ci NOT NULL,
`telefon` varchar(15) collate latin1_general_ci NOT NULL,
`email` varchar(100) collate latin1_general_ci NOT NULL,
`namasu` varchar(100) collate latin1_general_ci NOT NULL,
`icsu` varchar(14) collate latin1_general_ci NOT NULL,
`masadaftar` timestamp NOT NULL default CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=11 ;

--
-- Dumping data for table `daftar`
--
INSERT INTO `daftar` (`id`, `namapertubuhan`, `alamat`, `poskod`, `negeri`, `telefon`, `email`, `namasu`, `icsu`, `masadaftar`) VALUES
(1, 'Persatuan Kerabat Abd Rahman', 'Parit Sulong, Batu Pahat', '83500', '01', '0129034614', 'khirulnizam@gmail.com', 'Khirulnizam Abd Rahman', '760818017303', '2011-10-12 10:39:14'),
(2, 'Persatuan Pembangun Laman Web', 'Bangi', '43600', '10', '0389254251', 'webdev@gmail.com', 'Ali Mamat', '770801032872', '2011-10-12 10:39:14'),
(3, 'Rumah Amal Nilai', 'Taman Semarak, Nilai', '71700', '05', '0172131234', 'amalnilai@gmail.com', 'Faridah Ali', '870102142341', '2011-10-12 10:40:58'),
(10, 'Pertubuhan Web Se-Malaysia', 'Parit Jawa, Muar', '83000', '01', '', '', '', '', '2011-10-12 16:46:45');

-- --------------------------------------------------------

--
-- Table structure for table `negeri`
--
CREATE TABLE `negeri` (
`kodnegeri` varchar(2) collate latin1_general_ci NOT NULL,
`keterangan` varchar(50) collate latin1_general_ci NOT NULL,
PRIMARY KEY (`kodnegeri`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `negeri`
--
INSERT INTO `negeri` (`kodnegeri`, `keterangan`) VALUES
('01', 'Johor'),
('02', 'Kedah'),
('03', 'Kelantan'),
('04', 'Melaka'),
('05', 'Negeri Sembilan'),
('06', 'Pahang'),
('07', 'Pulau Pinang'),
('08', 'Perak'),
('09', 'Perlis'),
('10', 'Selangor'),
('11', 'Terengganu'),
('12', 'Sabah'),
('13', 'Sarawak'),
('14', 'Wilayah Persekutuan (Kuala Lumpur)'),
('15', 'Wilayah Persekutuan (Labuan)'),
('16', 'Wilayah Persekutuan (Putrajaya)');


 

Comments

Popular posts from this blog

Several English proverbs and the Malay pair

Or you could download here for the Malay proverbs app – https://play.google.com/store/apps/details?id=net.kerul.peribahasa English proverbs and the Malay pair Corpus Reference: Amir Muslim, 2009. Peribahasa dan ungkapan Inggeris-Melayu. DBP, Kuala Lumpur http://books.google.com.my/books/about/Peribahasa_dan_ungkapan_Inggeris_Melayu.html?id=bgwwQwAACAAJ CTRL+F to search Proverbs in English Definition in English Similar Malay Proverbs Definition in Malay 1 Where there is a country, there are people. A country must have people. Ada air adalah ikan. Ada negeri adalah rakyatnya. 2 Dry bread at home is better than roast meat home's the best hujan emas di negeri orang,hujan batu di negeri sendiri Betapa baik pun tempat orang, baik lagi tempat sendiri. 3 There's no accounting for tastes We can't assume that every people have a same feel Kepala sama hitam hati lain-lain. Dalam kehidupan ini, setiap insan berbeza cara, kesukaan, perangai, tabia...

Contact Us at blog.kerul.net

Powered by EMF HTML Contact Form

WebDev

http://blog.kerul.net PHP DEVELOPMENT TOOLS Download the XAMPP latest version from www.apachefriends.org . This installation file contains the Apache web server, PHP 5 and 4 interpreter, and the MySQL 5 Community edition. - download latest version MozillaFireFox (OpenSource web browser firefox) – download latest version Google Chrome – fastest web browser on earcth – fast download chrome here TEACHING PLAN Download the teaching plan here for Web/Internet Programming ( download ) NOTES HTML references HTML Editor -  http://www.sublimetext.com/ Lab 1: HTML Basics -  http://www.w3schools.com/html/ Lab 2: Responsive Design:  http://www.w3schools.com/html/html_responsive.asp Lab 3: HTML Forms  http://www.w3schools.com/html/html_forms.asp Lab 4: HTML 5  http://www.w3schools.com/html/html5_intro.asp Lab 5: Bootstrap for responsive Web -  http...

Applications of Web 2.0

Web 2.0 describes the changing trends in the use of World Wide Web technology and web design that aim to enhance creativity , secure information sharing, collaboration and functionality of the web. Web 2.0 concepts have led to the development and evolution of web-based communities and hosted services , such as social-networking sites , video sharing sites , wikis , blogs . Find a website or web application that conform to the criteria of Web 2.0. Put the name of the application and the URL in the comment below. Please provide your full name and matrix number. Make sure the application you choose is not already chosen by your friend in the previous comment.

The Challenges of Handling Proverbs in Malay-English Machine Translation – a research paper

*This paper was presented in the 14th International Conference on Translation 2013 ( http://ppa14atf.usm.my/ ). 27 – 29 August 2013, Universiti Sains Malaysia, Penang. The PDF version is here: www.scribd.com/doc/163669571/Khirulnizam-The-Challenges-of-Automated-Detection-and-Translation-of-Malay-Proverb The test data is here: http://www.scribd.com/doc/163669588/Test-Data-for-the-Research-Paper-the-Challenges-of-Handling-Proverbs-in-Malay-English-Machine-Translation Khirulnizam Abd Rahman, Faculty of Information Science & Technology, KUIS Abstract: Proverb is a unique feature of Malay language in which a message or advice is not communicated indirectly through metaphoric phrases. However, the use of proverb will cause confusion or misinterpretation if one does not familiar with the phrases since they cannot be translated literally. This paper will discuss the process of automated filtering of Malay proverb in Malay text. The next process is translation. In machine translatio...