Loading ...
Sorry, an error occurred while loading the content.

Re: [id-php] Membuat Pencarian Data di PHP

Expand Messages
  • hendra hermasnyah
    data yang dari dalam database mas, ________________________________ From: mul14 To: id-php@yahoogroups.com Sent: Tue, May 4, 2010
    Message 1 of 20 , May 3, 2010
    • 0 Attachment
      data yang dari dalam database mas,




      ________________________________
      From: mul14 <mul14.net@...>
      To: id-php@yahoogroups.com
      Sent: Tue, May 4, 2010 10:21:40 AM
      Subject: Re: [id-php] Membuat Pencarian Data di PHP


      Data yang dimaksud data darimana? Apa data dari website lain? Atau data
      sendiri?

      Umumnya data disimpan didalam database.

      Untuk database yang menggunakan SQL, biasanya pencarian data dengan:

      SELECT * FROM `table` WHERE `name`='nama_ yg_dicari' AND
      `address`='alamat_ yg_dicari' ;

      Kalau dengan NoSQL,

      db.find({ name: 'nama yg dicari', address: 'alamat yg dicari' });

      On 2010-05-04, hendra <k3nzi_ktd@yahoo. com> wrote:
      >
      >
      >
      > Dear All,
      >
      > Saya mau tanya ni gimana ya cara membuat pencarian data pake php?
      > misalnya saya mau cari data berdasarkan nama dan alamat gimana caranya ya?
      > tolong ya saya baru belajar php ni, makasih atas bantuannya
      >
      >
      >

      --

      facebook.com/ mul14 | twitter.com/ mul14 | koprol.com/users/ mul14 | Yahoo! ID:
      phpmutant
      Indonesian Web Framework Community - http://framework. web.id
      Jogja Startup Community: bancakan.org

      --

      [Non-text portions of this message have been removed]







      [Non-text portions of this message have been removed]
    • mul14
      Yaa itu sudah dijelasin.. pake SQL. Pelajari cara menghubungkan PHP ke database. Misalnya dengan mysql mysql_connect, mysql_select_db, mysql_query, etc. Atau
      Message 2 of 20 , May 3, 2010
      • 0 Attachment
        Yaa itu sudah dijelasin.. pake SQL.

        Pelajari cara menghubungkan PHP ke database.

        Misalnya dengan mysql

        mysql_connect, mysql_select_db, mysql_query, etc.

        Atau lebih bagus lagi pake PDO. Karena bisa pindah-pindah database dengan
        mudah.


        [Non-text portions of this message have been removed]
      • hendra hermasnyah
        maaf mas maksudnya saya ingin buat form untuk pencarian data dari database mysql terus hasilnya ditampilkan didalam table, mungkin mas bisa bantu source code
        Message 3 of 20 , May 3, 2010
        • 0 Attachment
          maaf mas maksudnya saya ingin buat form untuk pencarian data dari database mysql terus hasilnya ditampilkan didalam table, mungkin mas bisa bantu source code nya, makasih




          ________________________________
          From: mul14 <mul14.net@...>
          To: id-php@yahoogroups.com
          Sent: Tue, May 4, 2010 10:33:49 AM
          Subject: Re: [id-php] Membuat Pencarian Data di PHP


          Yaa itu sudah dijelasin.. pake SQL.

          Pelajari cara menghubungkan PHP ke database.

          Misalnya dengan mysql

          mysql_connect, mysql_select_ db, mysql_query, etc.

          Atau lebih bagus lagi pake PDO. Karena bisa pindah-pindah database dengan
          mudah.

          [Non-text portions of this message have been removed]







          [Non-text portions of this message have been removed]
        • mul14
          mysql_connect( localhost , user , password ); mysql_select_db( dbname ); $result = mysql_query( SELECT * FROM `tablename` ); while ($row =
          Message 4 of 20 , May 3, 2010
          • 0 Attachment
            mysql_connect('localhost', 'user', 'password');

            mysql_select_db('dbname');

            $result = mysql_query('SELECT * FROM `tablename`');

            while ($row = mysql_fetch_object($result)) {

            echo $row->fieldname;

            }

            Done...

            On 2010-05-04, hendra hermasnyah <k3nzi_ktd@...> wrote:
            >
            >
            >
            >
            >
            > maaf mas maksudnya saya ingin buat form untuk pencarian data dari database
            > mysql terus hasilnya ditampilkan didalam table, mungkin mas bisa bantu
            > source code nya, makasih
            >
            > ________________________________
            > From: mul14 <mul14.net@... <mul14.net%40gmail.com>>
            > To: id-php@yahoogroups.com <id-php%40yahoogroups.com>
            > Sent: Tue, May 4, 2010 10:33:49 AM
            > Subject: Re: [id-php] Membuat Pencarian Data di PHP
            >
            > Yaa itu sudah dijelasin.. pake SQL.
            >
            > Pelajari cara menghubungkan PHP ke database.
            >
            > Misalnya dengan mysql
            >
            > mysql_connect, mysql_select_ db, mysql_query, etc.
            >
            > Atau lebih bagus lagi pake PDO. Karena bisa pindah-pindah database dengan
            > mudah.
            >
            > [Non-text portions of this message have been removed]
            >
            > [Non-text portions of this message have been removed]
            >
            >
            >



            --

            facebook.com/mul14 | twitter.com/mul14 | koprol.com/users/mul14 | Yahoo! ID:
            phpmutant
            Indonesian Web Framework Community - http://framework.web.id
            Jogja Startup Community: bancakan.org

            --


            [Non-text portions of this message have been removed]
          • mul14
            Pake PHP Framework aja deh. Di CI ada helper yg otomatis generate ke table. Gabung aja di http://framework.web.id/ Jelasin nya lebih enak krn bs syntax
            Message 5 of 20 , May 3, 2010
            • 0 Attachment
              Pake PHP Framework aja deh. Di CI ada helper yg otomatis generate ke table.

              Gabung aja di http://framework.web.id/

              Jelasin nya lebih enak krn bs syntax highlight.

              On 2010-05-04, mul14 <mul14@...> wrote:
              >
              > mysql_connect('localhost', 'user', 'password');
              >
              > mysql_select_db('dbname');
              >
              > $result = mysql_query('SELECT * FROM `tablename`');
              >
              > while ($row = mysql_fetch_object($result)) {
              >
              > echo $row->fieldname;
              >
              > }
              >
              > Done...
              >
              > On 2010-05-04, hendra hermasnyah <k3nzi_ktd@...> wrote:
              >>
              >>
              >>
              >>
              >>
              >> maaf mas maksudnya saya ingin buat form untuk pencarian data dari database
              >> mysql terus hasilnya ditampilkan didalam table, mungkin mas bisa bantu
              >> source code nya, makasih
              >>
              >> ________________________________
              >> From: mul14 <mul14.net@... <mul14.net%40gmail.com>>
              >> To: id-php@yahoogroups.com <id-php%40yahoogroups.com>
              >> Sent: Tue, May 4, 2010 10:33:49 AM
              >> Subject: Re: [id-php] Membuat Pencarian Data di PHP
              >>
              >> Yaa itu sudah dijelasin.. pake SQL.
              >>
              >> Pelajari cara menghubungkan PHP ke database.
              >>
              >> Misalnya dengan mysql
              >>
              >> mysql_connect, mysql_select_ db, mysql_query, etc.
              >>
              >> Atau lebih bagus lagi pake PDO. Karena bisa pindah-pindah database dengan
              >> mudah.
              >>
              >> [Non-text portions of this message have been removed]
              >>
              >> [Non-text portions of this message have been removed]
              >>
              >>
              >>
              >
              >
              >
              > --
              >
              > facebook.com/mul14 | twitter.com/mul14 | koprol.com/users/mul14 | Yahoo!
              > ID: phpmutant
              > Indonesian Web Framework Community - http://framework.web.id
              > Jogja Startup Community: bancakan.org
              >
              > --
              >
              >
              >


              --

              facebook.com/mul14 | twitter.com/mul14 | koprol.com/users/mul14 | Yahoo! ID:
              phpmutant
              Indonesian Web Framework Community - http://framework.web.id
              Jogja Startup Community: bancakan.org

              --


              [Non-text portions of this message have been removed]
            • arie.wijayanto
              bbrp pertanyaan sebelum melanjutkan: 1. apakah anda tau host, username, password server mysql nya? -- utk menentukan parameter mysql_connect 2. apakah data
              Message 6 of 20 , May 3, 2010
              • 0 Attachment
                bbrp pertanyaan sebelum melanjutkan:

                1. apakah anda tau host, username, password server mysql nya? --> utk
                menentukan parameter mysql_connect

                2. apakah data tersebut sudah tersedia di database? --> klo ga ada
                data, apa yg mo di search

                3. bagaimanakah struktur database tersebut? ---> utk menentukan query SELECT

                4. apakah form tersebut standalone ato terintegrasi dgn situs utama?
                ---> utk menentukan code html form nya

                ---
                Arie Wijayanto
                news.arie-online.net
                ---


                2010/5/4 hendra hermasnyah <k3nzi_ktd@...>
                >
                >
                >
                > maaf mas maksudnya saya ingin buat form untuk pencarian data dari database mysql terus hasilnya ditampilkan didalam table, mungkin mas bisa bantu source code nya, makasih
              • mul14
                Yaa.. itu sebenernya pertanyaan penting. TS ini bener2 baru dan masih blank ya?? Btw webserver dan php nya udah bisa jalan?? ... -- facebook.com/mul14 |
                Message 7 of 20 , May 3, 2010
                • 0 Attachment
                  Yaa.. itu sebenernya pertanyaan penting. TS ini bener2 baru dan masih blank
                  ya?? Btw webserver dan php nya udah bisa jalan??

                  On 2010-05-04, arie.wijayanto <mail@...> wrote:
                  >
                  >
                  >
                  > bbrp pertanyaan sebelum melanjutkan:
                  >
                  > 1. apakah anda tau host, username, password server mysql nya? --> utk
                  > menentukan parameter mysql_connect
                  >
                  > 2. apakah data tersebut sudah tersedia di database? --> klo ga ada
                  > data, apa yg mo di search
                  >
                  > 3. bagaimanakah struktur database tersebut? ---> utk menentukan query
                  > SELECT
                  >
                  > 4. apakah form tersebut standalone ato terintegrasi dgn situs utama?
                  > ---> utk menentukan code html form nya
                  >
                  > ---
                  > Arie Wijayanto
                  > news.arie-online.net
                  > ---
                  >
                  > 2010/5/4 hendra hermasnyah <k3nzi_ktd@... <k3nzi_ktd%40yahoo.com>>
                  > >
                  > >
                  > >
                  > > maaf mas maksudnya saya ingin buat form untuk pencarian data dari
                  > database mysql terus hasilnya ditampilkan didalam table, mungkin mas bisa
                  > bantu source code nya, makasih
                  >
                  >



                  --

                  facebook.com/mul14 | twitter.com/mul14 | koprol.com/users/mul14 | Yahoo! ID:
                  phpmutant
                  Indonesian Web Framework Community - http://framework.web.id
                  Jogja Startup Community: bancakan.org

                  --


                  [Non-text portions of this message have been removed]
                • hendra hermasnyah
                  saya masih pakenya di Localhost, databasenya juga sudah saya buat ________________________________ From: arie.wijayanto To:
                  Message 8 of 20 , May 3, 2010
                  • 0 Attachment
                    saya masih pakenya di Localhost, databasenya juga sudah saya buat





                    ________________________________
                    From: arie.wijayanto <mail@...>
                    To: id-php@yahoogroups.com
                    Sent: Tue, May 4, 2010 1:19:39 PM
                    Subject: Re: [id-php] Membuat Pencarian Data di PHP


                    bbrp pertanyaan sebelum melanjutkan:

                    1. apakah anda tau host, username, password server mysql nya? --> utk
                    menentukan parameter mysql_connect

                    2. apakah data tersebut sudah tersedia di database? --> klo ga ada
                    data, apa yg mo di search

                    3. bagaimanakah struktur database tersebut? ---> utk menentukan query SELECT

                    4. apakah form tersebut standalone ato terintegrasi dgn situs utama?
                    ---> utk menentukan code html form nya

                    ---
                    Arie Wijayanto
                    news.arie-online. net
                    ---

                    2010/5/4 hendra hermasnyah <k3nzi_ktd@yahoo. com>
                    >
                    >
                    >
                    > maaf mas maksudnya saya ingin buat form untuk pencarian data dari database mysql terus hasilnya ditampilkan didalam table, mungkin mas bisa bantu source code nya, makasih






                    [Non-text portions of this message have been removed]
                  • mul14
                    Busyett.. infonya bener2 minim.... Nih kasi contoh satu file. Anggap deh nama table mu person ... id | name | address ... 1 | kucing | jln buntu 2 | kuda | jln
                    Message 9 of 20 , May 3, 2010
                    • 0 Attachment
                      Busyett.. infonya bener2 minim....

                      Nih kasi contoh satu file. Anggap deh nama table mu person
                      ------------------------
                      id | name | address
                      ------------------------
                      1 | kucing | jln buntu
                      2 | kuda | jln aneh

                      <form method="post">
                      Cari <input type="text" name="carideh" /><input type="submit"/>
                      </form>

                      <?php
                      if ($_POST) {
                      $carideh = $_POST['carideh'];
                      mysql_connect('localhost', 'uname', 'pwd');
                      mysql_select_db('nama_database_mu');
                      $sql = "SELECT * FROM `person` WHERE `name`='%{$carideh}%' OR
                      `address`='%{$carideh}%'";
                      $result = mysql_query($sql);
                      echo "<table>";
                      while ($row = mysql_fetch_object($result))
                      {
                      echo "<tr>";
                      echo "<td>" . $row->name . "</td><td>" . $row->address . "</td>";
                      echo "</tr>";
                      }
                      echo "</table>";
                      }

                      ?>


                      [Non-text portions of this message have been removed]
                    • vandai
                      jujur aja, sebenernya niat pengen ngebantu. tapi kalau info nya sangat minim seperti ini malah bikin jadi males. seolah2 pengen punya solusi cepat dan mudah
                      Message 10 of 20 , May 4, 2010
                      • 0 Attachment
                        jujur aja,
                        sebenernya niat pengen ngebantu.
                        tapi kalau info nya sangat minim seperti ini malah bikin jadi males.
                        seolah2 pengen punya solusi cepat dan mudah tapi tanpa usaha.

                        tolonglah, kalau memang pengen dapet bantuan, jika bertanya dan ditanya itu
                        sebisa mungkin berikan informasi detail.
                        apa yang sudah anda kerjakan, apa permasalahannya, mentoknya dimana..
                        kalau informasi dari anda lengkap, kita juga bisa ngebantu anda dengan
                        mudah.

                        dari awal temen yang lain sudah coba kasih solusi, bahkan sampe panjang
                        lebar.
                        tapi respon anda sangat minim.

                        kalau seperti itu, sama aja dengen permintaan: "tolong dong bikinin aplikasi
                        search engine yang lengkap komplit plit plit dan saya tinggal pasang
                        beres.."

                        no offense yah,
                        sekedar mengingatkan.
                        namanya diskusi yah harus informatif.
                        gimana orang lain bisa mengerti permasalahan anda jika anda sendiri tidak
                        mau memberikan informasi detail.



                        2010/5/4 hendra hermasnyah <k3nzi_ktd@...>

                        >
                        >
                        > saya masih pakenya di Localhost, databasenya juga sudah saya buat
                        >
                        > ________________________________
                        > From: arie.wijayanto <mail@... <mail%40arie-online.net>>
                        >
                        > To: id-php@yahoogroups.com <id-php%40yahoogroups.com>
                        > Sent: Tue, May 4, 2010 1:19:39 PM
                        >
                        > Subject: Re: [id-php] Membuat Pencarian Data di PHP
                        >
                        > bbrp pertanyaan sebelum melanjutkan:
                        >
                        > 1. apakah anda tau host, username, password server mysql nya? --> utk
                        > menentukan parameter mysql_connect
                        >
                        > 2. apakah data tersebut sudah tersedia di database? --> klo ga ada
                        > data, apa yg mo di search
                        >
                        > 3. bagaimanakah struktur database tersebut? ---> utk menentukan query
                        > SELECT
                        >
                        > 4. apakah form tersebut standalone ato terintegrasi dgn situs utama?
                        > ---> utk menentukan code html form nya
                        >
                        > _._,___
                        >



                        --
                        ------------------------------------------------------
                        http://hi.im/miaz/


                        [Non-text portions of this message have been removed]
                      • hendra hermasnyah
                        maaf mas sebentar saya kirimkan file phpnya dan databasenya ________________________________ From: mul14 To: id-php@yahoogroups.com Sent:
                        Message 11 of 20 , May 4, 2010
                        • 0 Attachment
                          maaf mas sebentar saya kirimkan file phpnya dan databasenya





                          ________________________________
                          From: mul14 <mul14.net@...>
                          To: id-php@yahoogroups.com
                          Sent: Tue, May 4, 2010 1:50:49 PM
                          Subject: Re: [id-php] Membuat Pencarian Data di PHP


                          Busyett.. infonya bener2 minim....

                          Nih kasi contoh satu file. Anggap deh nama table mu person
                          ------------ --------- ---
                          id | name | address
                          ------------ --------- ---
                          1 | kucing | jln buntu
                          2 | kuda | jln aneh

                          <form method="post" >
                          Cari <input type="text" name="carideh" /><input type="submit" />
                          </form>

                          <?php
                          if ($_POST) {
                          $carideh = $_POST['carideh' ];
                          mysql_connect( 'localhost' , 'uname', 'pwd');
                          mysql_select_ db('nama_ database_ mu');
                          $sql = "SELECT * FROM `person` WHERE `name`='%{$carideh} %' OR
                          `address`='% {$carideh} %'";
                          $result = mysql_query( $sql);
                          echo "<table>";
                          while ($row = mysql_fetch_ object($result) )
                          {
                          echo "<tr>";
                          echo "<td>" . $row->name . "</td><td>" . $row->address . "</td>";
                          echo "</tr>";
                          }
                          echo "</table>";
                          }

                          ?>

                          [Non-text portions of this message have been removed]







                          [Non-text portions of this message have been removed]
                        • hendra hermasnyah
                          file databasenya CREATE DATABASE dbsimso; USE `dbsimso`; CREATE TABLE `mlantaih` ( `kdlt` varchar(5) NOT NULL, `nmlt` varchar(20) DEFAULT NULL, `ls`
                          Message 12 of 20 , May 4, 2010
                          • 0 Attachment
                            file databasenya

                            CREATE DATABASE dbsimso;

                            USE `dbsimso`;

                            CREATE TABLE `mlantaih` (
                            `kdlt` varchar(5) NOT NULL,
                            `nmlt` varchar(20) DEFAULT NULL,
                            `ls` decimal(15,2) DEFAULT NULL,
                            PRIMARY KEY (`kdlt`)
                            ) ENGINE=MyISAM DEFAULT CHARSET=utf8;

                            insert into `mlantaih`(`kdlt`,`nmlt`,`ls`) values ('LT002','Semibasement','234.00'),('LT001','Basement','454.00'),('LT003','Lantai Dasar','122.00'),('LT004','Lantai 1','540.00'),('LT005','Lantai 2','233.00');
                            -------------------------------------------------------------------------------------------
                            //connectdb.php
                            <?
                            $dbhost='localhost'; //local
                            $dbusername='root';
                            $dbuserpassword='1234';
                            $default_dbname='dbsimso';

                            $MYSQL_ERRNO='';
                            $MYSQL_ERROR='';

                            function db_connect() {
                            global $dbhost, $dbusername, $dbuserpassword, $default_dbname;
                            global $MYSQL_ERRNO, $MYSQL_ERROR;
                            $link_id = mysql_connect($dbhost, $dbusername, $dbuserpassword);
                            if(!$link_id) {
                            $MYSQL_ERRNO=0;
                            $MYSQL_ERROR='Connection failed';
                            return 0;
                            } elseif (empty($dbname) && !mysql_select_db($default_dbname)){
                            $MYSQL_ERRNO = mysql_errno();
                            $MYSQL_ERROR = mysql_error();
                            return 0;
                            } else return $link_id;
                            }

                            function sql_error() {
                            global $MYSQL_ERRNO, $MYSQL_ERROR;
                            if(empty($MYSQL_ERROR)) {
                            $MYSQL_ERRNO = mysql_errno();
                            $MYSQL_ERROR = mysql_error();
                            }
                            return "$MYSQL_ERRNO : $MYSQL_ERROR";
                            }
                            //end connect_db

                            error_reporting(0);
                            $link_id = db_connect();
                            ?>
                            ==================================================
                            //query.php
                            <?

                            $que_edeposit="select kdlt, nmlt, ls from mlantaih ";

                            $query02="select kdlt, nmlt, ls from mlantaih where 1=1 ";
                            $default_order_by2 = ' order by kdlt ';

                            ?>
                            ==================================
                            //caridata.php
                            <?
                            require_once("connectdb.php");
                            require_once("query.php");
                            $no=0;
                            ?>
                            <html>
                            <head>
                            <title>Daftar Master Lantai</title>
                            </head>

                            <link href="/css/style.css" rel="stylesheet" type="text/css">
                            <body background="#FFCC00" topmargin="3" leftmargin="2">
                            <table width="100%" height="98%" border="0" cellpadding="5" cellspacing="1" align="center">
                            <table width="100%" border="0" cellpadding="5" cellspacing="1" align="center" >
                            <tr>
                            <td width="60%">
                            <font size="4"><B>Daftar Master Lantai</B></font>
                            </td>
                            <td width="20%" align="right">
                            <font color="#008EFF"> </font>
                            </td>
                            </tr>
                            </table>


                            <form name=admin action="<?php echo $_SERVER['PHP_SELF?cari=$cari=$cari$nama=$nama'] ?>" method="post">
                            <table width="90%" border="0" cellspacing="3" cellspacing="0">
                            <tr>
                            <td>Search By :
                            <select name="cari">
                            <option value="">All</option>
                            <option value="kode" <? if ($cari=="kode") {?> selected <? } ?> >Kode</option>
                            <option value="nama" <? if ($cari=="nama") {?> selected <? } ?> >Nama</option>
                            </select>
                            Keyword :
                            <input type="text" name="txtQword" value=<?=$txtQword?>>
                            <input type="submit" name="submit" value="Search" class=btn-normal>
                            </td>
                            </tr>
                            </table>
                            </form>

                            <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center" >
                            <tr bgcolor="#FFCC00"><td><img src="/image/bluedot11.gif" width="1" height="1"></td></tr>
                            </table><br>
                            <table width="70%" border="0" cellpadding="2" cellspacing="1" bgcolor="#FFFF99" >
                            <tr bgcolor="9BCB05">
                            <td width="5%"><div align="center"><b>No.</b></div></td>
                            <td width="5%"><div align="center"><b>Kode Lantai</b></div></td>
                            <td width="25%"><div align="center"><b>Nama Lantai</b></div></td>
                            <td width="10%"><div align="center"><b>Luas</b></div></td>
                            </tr>
                            <? include "../editmaster.php" ?>

                            <?
                            $no = 0 ;
                            $cmd=$query02;
                            if ($cari=='kode') {
                            $filter ="and kdlt like '%$txtQword%' ";
                            }
                            elseif ($cari=='nama') {
                            $filter=" and nmlt like '%$txtQword%' ";
                            }
                            else {
                            $filter=" ";
                            }


                            $cmd =$query02.$filter.$default_order_by2 ;
                            //echo $cmd;

                            //echo "AAA $cmd";
                            $sql = mysql_query($cmd, $link_id);
                            while ($data=mysql_fetch_array($sql)){
                            $no++;
                            ?>
                            <tr bgcolor="#F8F9C3" valign="top">
                            <td align="center"><div width="center"><?=$no?></div></td>
                            <td align="center"><?=$data[kdlt]?></td>
                            <td><a href="detail.php?id=<?=$data[kdlt]?>"><?=$data[nmlt]?></a></td>
                            <td align="center"><?=$data[ls]?></td>
                            <!--<td align="center"><?=$status?></td>-->
                            </tr>
                            <?
                            }
                            ?>
                            </table>
                            </td>
                            </tr>
                            </table>
                            </html>
                            =============================================================
                            Permasalahannya :
                            pada form cari data pas saya klik tombol search dengan kategori Nama Lantai misalnya saya Input "b" harusnya yang keluar hanya nama lantai yang berawalan atau yang mengandung huruf "b" saja yang muncul,
                            apa ada yang kurang dengan coding saya diatas, mohon koreksinya, terima kasih


                            ________________________________
                            From: mul14 <mul14.net@...>
                            To: id-php@yahoogroups.com
                            Sent: Tue, May 4, 2010 1:50:49 PM
                            Subject: Re: [id-php] Membuat Pencarian Data di PHP


                            Busyett.. infonya bener2 minim....

                            Nih kasi contoh satu file. Anggap deh nama table mu person
                            ------------ --------- ---
                            id | name | address
                            ------------ --------- ---
                            1 | kucing | jln buntu
                            2 | kuda | jln aneh

                            <form method="post" >
                            Cari <input type="text" name="carideh" /><input type="submit" />
                            </form>

                            <?php
                            if ($_POST) {
                            $carideh = $_POST['carideh' ];
                            mysql_connect( 'localhost' , 'uname', 'pwd');
                            mysql_select_ db('nama_ database_ mu');
                            $sql = "SELECT * FROM `person` WHERE `name`='%{$carideh} %' OR
                            `address`='% {$carideh} %'";
                            $result = mysql_query( $sql);
                            echo "<table>";
                            while ($row = mysql_fetch_ object($result) )
                            {
                            echo "<tr>";
                            echo "<td>" . $row->name . "</td><td>" . $row->address . "</td>";
                            echo "</tr>";
                            }
                            echo "</table>";
                            }

                            ?>

                            [Non-text portions of this message have been removed]







                            [Non-text portions of this message have been removed]
                          • mul14
                            Ganti *$cari* jadi *$_POST[ cari ]*; Ganti *$**txtQword* jadi *$_POST[ txtQword ]*; ... -- facebook.com/mul14 | twitter.com/mul14 | koprol.com/users/mul14 |
                            Message 13 of 20 , May 4, 2010
                            • 0 Attachment
                              Ganti *$cari* jadi *$_POST['cari']*;

                              Ganti *$**txtQword* jadi *$_POST['txtQword']*;



                              On 2010-05-04, hendra hermasnyah <k3nzi_ktd@...> wrote:
                              >
                              >
                              >
                              > file databasenya
                              >
                              > CREATE DATABASE dbsimso;
                              >
                              > USE `dbsimso`;
                              >
                              > CREATE TABLE `mlantaih` (
                              > `kdlt` varchar(5) NOT NULL,
                              > `nmlt` varchar(20) DEFAULT NULL,
                              > `ls` decimal(15,2) DEFAULT NULL,
                              > PRIMARY KEY (`kdlt`)
                              > ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
                              >
                              > insert into `mlantaih`(`kdlt`,`nmlt`,`ls`) values
                              > ('LT002','Semibasement','234.00'),('LT001','Basement','454.00'),('LT003','Lantai
                              > Dasar','122.00'),('LT004','Lantai 1','540.00'),('LT005','Lantai
                              > 2','233.00');
                              > ----------------------------------------------------------
                              > //connectdb.php
                              > <?
                              > $dbhost='localhost'; //local
                              > $dbusername='root';
                              > $dbuserpassword='1234';
                              > $default_dbname='dbsimso';
                              >
                              > $MYSQL_ERRNO='';
                              > $MYSQL_ERROR='';
                              >
                              > function db_connect() {
                              > global $dbhost, $dbusername, $dbuserpassword, $default_dbname;
                              > global $MYSQL_ERRNO, $MYSQL_ERROR;
                              > $link_id = mysql_connect($dbhost, $dbusername, $dbuserpassword);
                              > if(!$link_id) {
                              > $MYSQL_ERRNO=0;
                              > $MYSQL_ERROR='Connection failed';
                              > return 0;
                              > } elseif (empty($dbname) && !mysql_select_db($default_dbname)){
                              > $MYSQL_ERRNO = mysql_errno();
                              > $MYSQL_ERROR = mysql_error();
                              > return 0;
                              > } else return $link_id;
                              > }
                              >
                              > function sql_error() {
                              > global $MYSQL_ERRNO, $MYSQL_ERROR;
                              > if(empty($MYSQL_ERROR)) {
                              > $MYSQL_ERRNO = mysql_errno();
                              > $MYSQL_ERROR = mysql_error();
                              > }
                              > return "$MYSQL_ERRNO : $MYSQL_ERROR";
                              > }
                              > //end connect_db
                              >
                              > error_reporting(0);
                              > $link_id = db_connect();
                              > ?>
                              > ==================================================
                              > //query.php
                              > <?
                              >
                              > $que_edeposit="select kdlt, nmlt, ls from mlantaih ";
                              >
                              > $query02="select kdlt, nmlt, ls from mlantaih where 1=1 ";
                              > $default_order_by2 = ' order by kdlt ';
                              >
                              > ?>
                              > ==================================
                              > //caridata.php
                              > <?
                              > require_once("connectdb.php");
                              > require_once("query.php");
                              > $no=0;
                              > ?>
                              > <html>
                              > <head>
                              > <title>Daftar Master Lantai</title>
                              > </head>
                              >
                              > <link href="/css/style.css" rel="stylesheet" type="text/css">
                              > <body background="#FFCC00" topmargin="3" leftmargin="2">
                              > <table width="100%" height="98%" border="0" cellpadding="5" cellspacing="1"
                              > align="center">
                              > <table width="100%" border="0" cellpadding="5" cellspacing="1"
                              > align="center" >
                              > <tr>
                              > <td width="60%">
                              > <font size="4"><B>Daftar Master Lantai</B></font>
                              > </td>
                              > <td width="20%" align="right">
                              > <font color="#008EFF"> </font>
                              > </td>
                              > </tr>
                              > </table>
                              >
                              > <form name=admin action="<?php echo
                              > $_SERVER['PHP_SELF?cari=$cari=$cari$nama=$nama'] ?>" method="post">
                              > <table width="90%" border="0" cellspacing="3" cellspacing="0">
                              > <tr>
                              > <td>Search By :
                              > <select name="cari">
                              > <option value="">All</option>
                              > <option value="kode" <? if ($cari=="kode") {?> selected <? } ?>
                              > >Kode</option>
                              > <option value="nama" <? if ($cari=="nama") {?> selected <? } ?>
                              > >Nama</option>
                              > </select>
                              > Keyword :
                              > <input type="text" name="txtQword" value=<?=$txtQword?>>
                              > <input type="submit" name="submit" value="Search" class=btn-normal>
                              > </td>
                              > </tr>
                              > </table>
                              > </form>
                              >
                              > <table width="100%" border="0" cellspacing="0" cellpadding="0"
                              > align="center" >
                              > <tr bgcolor="#FFCC00"><td><img src="/image/bluedot11.gif" width="1"
                              > height="1"></td></tr>
                              > </table><br>
                              > <table width="70%" border="0" cellpadding="2" cellspacing="1"
                              > bgcolor="#FFFF99" >
                              > <tr bgcolor="9BCB05">
                              > <td width="5%"><div align="center"><b>No.</b></div></td>
                              > <td width="5%"><div align="center"><b>Kode Lantai</b></div></td>
                              > <td width="25%"><div align="center"><b>Nama Lantai</b></div></td>
                              > <td width="10%"><div align="center"><b>Luas</b></div></td>
                              > </tr>
                              > <? include "../editmaster.php" ?>
                              >
                              > <?
                              > $no = 0 ;
                              > $cmd=$query02;
                              > if ($cari=='kode') {
                              > $filter ="and kdlt like '%$txtQword%' ";
                              > }
                              > elseif ($cari=='nama') {
                              > $filter=" and nmlt like '%$txtQword%' ";
                              > }
                              > else {
                              > $filter=" ";
                              > }
                              >
                              > $cmd =$query02.$filter.$default_order_by2 ;
                              > //echo $cmd;
                              >
                              > //echo "AAA $cmd";
                              > $sql = mysql_query($cmd, $link_id);
                              > while ($data=mysql_fetch_array($sql)){
                              > $no++;
                              > ?>
                              > <tr bgcolor="#F8F9C3" valign="top">
                              > <td align="center"><div width="center"><?=$no?></div></td>
                              > <td align="center"><?=$data[kdlt]?></td>
                              > <td><a href="detail.php?id=<?=$data[kdlt]?>"><?=$data[nmlt]?></a></td>
                              > <td align="center"><?=$data[ls]?></td>
                              > <!--<td align="center"><?=$status?></td>-->
                              > </tr>
                              > <?
                              > }
                              > ?>
                              > </table>
                              > </td>
                              > </tr>
                              > </table>
                              > </html>
                              > =============================================================
                              > Permasalahannya :
                              > pada form cari data pas saya klik tombol search dengan kategori Nama Lantai
                              > misalnya saya Input "b" harusnya yang keluar hanya nama lantai yang
                              > berawalan atau yang mengandung huruf "b" saja yang muncul,
                              > apa ada yang kurang dengan coding saya diatas, mohon koreksinya, terima
                              > kasih
                              >
                              > ________________________________
                              > From: mul14 <mul14.net@... <mul14.net%40gmail.com>>
                              > To: id-php@yahoogroups.com <id-php%40yahoogroups.com>
                              > Sent: Tue, May 4, 2010 1:50:49 PM
                              > Subject: Re: [id-php] Membuat Pencarian Data di PHP
                              >
                              > Busyett.. infonya bener2 minim....
                              >
                              > Nih kasi contoh satu file. Anggap deh nama table mu person
                              > ------------ --------- ---
                              > id | name | address
                              > ------------ --------- ---
                              > 1 | kucing | jln buntu
                              > 2 | kuda | jln aneh
                              >
                              > <form method="post" >
                              > Cari <input type="text" name="carideh" /><input type="submit" />
                              > </form>
                              >
                              > <?php
                              > if ($_POST) {
                              > $carideh = $_POST['carideh' ];
                              > mysql_connect( 'localhost' , 'uname', 'pwd');
                              > mysql_select_ db('nama_ database_ mu');
                              > $sql = "SELECT * FROM `person` WHERE `name`='%{$carideh} %' OR
                              > `address`='% {$carideh} %'";
                              > $result = mysql_query( $sql);
                              > echo "<table>";
                              > while ($row = mysql_fetch_ object($result) )
                              > {
                              > echo "<tr>";
                              > echo "<td>" . $row->name . "</td><td>" . $row->address . "</td>";
                              > echo "</tr>";
                              > }
                              > echo "</table>";
                              > }
                              >
                              > ?>
                              >
                              > [Non-text portions of this message have been removed]
                              >
                              > [Non-text portions of this message have been removed]
                              >
                              >
                              >



                              --

                              facebook.com/mul14 | twitter.com/mul14 | koprol.com/users/mul14 | Yahoo! ID:
                              phpmutant
                              Indonesian Web Framework Community - http://framework.web.id
                              Jogja Startup Community: bancakan.org

                              --


                              [Non-text portions of this message have been removed]
                            • Bobby Nugraha Ariffin
                              kok ada where 1=1 ? kalo gini semua data bakal keluar... coba baca2 lagi tentang Query LIKE di MySql my blog... bahasa: http://bob.web.id/ english:
                              Message 14 of 20 , May 4, 2010
                              • 0 Attachment
                                kok ada where 1=1 ? kalo gini semua data bakal keluar...
                                coba baca2 lagi tentang Query LIKE di MySql


                                my blog...
                                bahasa: http://bob.web.id/
                                english: http://seekbob.com/





                                ________________________________
                                Dari: hendra hermasnyah <k3nzi_ktd@...>
                                Kepada: id-php@yahoogroups.com
                                Terkirim: Sel, 4 Mei, 2010 15:09:01
                                Judul: Re: [id-php] Membuat Pencarian Data di PHP


                                file databasenya

                                CREATE DATABASE dbsimso;

                                USE `dbsimso`;

                                CREATE TABLE `mlantaih` (
                                `kdlt` varchar(5) NOT NULL,
                                `nmlt` varchar(20) DEFAULT NULL,
                                `ls` decimal(15,2) DEFAULT NULL,
                                PRIMARY KEY (`kdlt`)
                                ) ENGINE=MyISAM DEFAULT CHARSET=utf8;

                                insert into `mlantaih`(` kdlt`,`nmlt` ,`ls`) values ('LT002','Semibasem ent','234. 00'),('LT001' ,'Basement' ,'454.00' ),('LT003' ,'Lantai Dasar','122. 00'),('LT004' ,'Lantai 1','540.00') ,('LT005' ,'Lantai 2','233.00') ;
                                ------------ --------- --------- --------- --------- --------- -
                                //connectdb. php
                                <?
                                $dbhost='localhost' ; //local
                                $dbusername= 'root';
                                $dbuserpassword= '1234';
                                $default_dbname= 'dbsimso' ;

                                $MYSQL_ERRNO= '';
                                $MYSQL_ERROR= '';

                                function db_connect() {
                                global $dbhost, $dbusername, $dbuserpassword, $default_dbname;
                                global $MYSQL_ERRNO, $MYSQL_ERROR;
                                $link_id = mysql_connect( $dbhost, $dbusername, $dbuserpassword) ;
                                if(!$link_id) {
                                $MYSQL_ERRNO= 0;
                                $MYSQL_ERROR= 'Connection failed';
                                return 0;
                                } elseif (empty($dbname) && !mysql_select_ db($default_ dbname)){
                                $MYSQL_ERRNO = mysql_errno( );
                                $MYSQL_ERROR = mysql_error( );
                                return 0;
                                } else return $link_id;
                                }

                                function sql_error() {
                                global $MYSQL_ERRNO, $MYSQL_ERROR;
                                if(empty($MYSQL_ ERROR)) {
                                $MYSQL_ERRNO = mysql_errno( );
                                $MYSQL_ERROR = mysql_error( );
                                }
                                return "$MYSQL_ERRNO : $MYSQL_ERROR" ;
                                }
                                //end connect_db

                                error_reporting( 0);
                                $link_id = db_connect() ;
                                ?>
                                ============ ========= ========= ========= ========= ==
                                //query.php
                                <?

                                $que_edeposit= "select kdlt, nmlt, ls from mlantaih ";

                                $query02="select kdlt, nmlt, ls from mlantaih where 1=1 ";
                                $default_order_ by2 = ' order by kdlt ';

                                ?>
                                ============ ========= ========= ====
                                //caridata.php
                                <?
                                require_once( "connectdb. php");
                                require_once( "query.php" );
                                $no=0;
                                ?>
                                <html>
                                <head>
                                <title>Daftar Master Lantai</title>
                                </head>

                                <link href="/css/style. css" rel="stylesheet" type="text/css" >
                                <body background=" #FFCC00" topmargin="3" leftmargin=" 2">
                                <table width="100%" height="98%" border="0" cellpadding= "5" cellspacing= "1" align="center" >
                                <table width="100%" border="0" cellpadding= "5" cellspacing= "1" align="center" >
                                <tr>
                                <td width="60%">
                                <font size="4"><B> Daftar Master Lantai</B></ font>
                                </td>
                                <td width="20%" align="right" >
                                <font color="#008EFF" > </ font>
                                </td>
                                </tr>
                                </table>

                                <form name=admin action="<?php echo $_SERVER['PHP_ SELF?cari= $cari=$cari$ nama=$nama' ] ?>" method="post" >
                                <table width="90%" border="0" cellspacing= "3" cellspacing= "0">
                                <tr>
                                <td>Search By :
                                <select name="cari">
                                <option value="">All< /option>
                                <option value="kode" <? if ($cari=="kode" ) {?> selected <? } ?> >Kode</option>
                                <option value="nama" <? if ($cari=="nama" ) {?> selected <? } ?> >Nama</option>
                                </select>
                                Keyword :
                                <input type="text" name="txtQword" value=<?=$txtQword? >>
                                <input type="submit" name="submit" value="Search" class=btn-normal>
                                </td>
                                </tr>
                                </table>
                                </form>

                                <table width="100%" border="0" cellspacing= "0" cellpadding= "0" align="center" >
                                <tr bgcolor="#FFCC00" ><td><img src="/image/ bluedot11. gif" width="1" height="1">< /td></tr>
                                </table><br>
                                <table width="70%" border="0" cellpadding= "2" cellspacing= "1" bgcolor="#FFFF99" >
                                <tr bgcolor="9BCB05" >
                                <td width="5%">< div align="center" ><b>No.</ b></div>< /td>
                                <td width="5%">< div align="center" ><b>Kode Lantai</b></ div></td>
                                <td width="25%"> <div align="center" ><b>Nama Lantai</b></ div></td>
                                <td width="10%"> <div align="center" ><b>Luas< /b></div> </td>
                                </tr>
                                <? include "../editmaster. php" ?>

                                <?
                                $no = 0 ;
                                $cmd=$query02;
                                if ($cari=='kode' ) {
                                $filter ="and kdlt like '%$txtQword% ' ";
                                }
                                elseif ($cari=='nama' ) {
                                $filter=" and nmlt like '%$txtQword% ' ";
                                }
                                else {
                                $filter=" ";
                                }

                                $cmd =$query02.$filter. $default_ order_by2 ;
                                //echo $cmd;

                                //echo "AAA $cmd";
                                $sql = mysql_query( $cmd, $link_id);
                                while ($data=mysql_ fetch_array( $sql)){
                                $no++;
                                ?>
                                <tr bgcolor="#F8F9C3" valign="top" >
                                <td align="center" ><div width="center" ><?=$no?> </div></td>
                                <td align="center" ><?=$data[ kdlt]?></ td>
                                <td><a href="detail. php?id=<? =$data[kdlt] ?>"><?=$data[ nmlt]?></ a></td>
                                <td align="center" ><?=$data[ ls]?></td>
                                <!--<td align="center" ><?=$status? ></td>-->
                                </tr>
                                <?
                                }
                                ?>
                                </table>
                                </td>
                                </tr>
                                </table>
                                </html>
                                ============ ========= ========= ========= ========= ========= ====
                                Permasalahannya :
                                pada form cari data pas saya klik tombol search dengan kategori Nama Lantai misalnya saya Input "b" harusnya yang keluar hanya nama lantai yang berawalan atau yang mengandung huruf "b" saja yang muncul,
                                apa ada yang kurang dengan coding saya diatas, mohon koreksinya, terima kasih

                                ____________ _________ _________ __
                                From: mul14 <mul14.net@gmail. com>
                                To: id-php@yahoogroups. com
                                Sent: Tue, May 4, 2010 1:50:49 PM
                                Subject: Re: [id-php] Membuat Pencarian Data di PHP

                                Busyett.. infonya bener2 minim....

                                Nih kasi contoh satu file. Anggap deh nama table mu person
                                ------------ --------- ---
                                id | name | address
                                ------------ --------- ---
                                1 | kucing | jln buntu
                                2 | kuda | jln aneh

                                <form method="post" >
                                Cari <input type="text" name="carideh" /><input type="submit" />
                                </form>

                                <?php
                                if ($_POST) {
                                $carideh = $_POST['carideh' ];
                                mysql_connect( 'localhost' , 'uname', 'pwd');
                                mysql_select_ db('nama_ database_ mu');
                                $sql = "SELECT * FROM `person` WHERE `name`='%{$carideh} %' OR
                                `address`='% {$carideh} %'";
                                $result = mysql_query( $sql);
                                echo "<table>";
                                while ($row = mysql_fetch_ object($result) )
                                {
                                echo "<tr>";
                                echo "<td>" . $row->name . "</td><td>" . $row->address . "</td>";
                                echo "</tr>";
                                }
                                echo "</table>";
                                }

                                ?>

                                [Non-text portions of this message have been removed]

                                [Non-text portions of this message have been removed]






                                [Non-text portions of this message have been removed]
                              • hendra hermasnyah
                                terima kasih banyak mas atas masukannya ^-^ ________________________________ From: mul14 To: id-php@yahoogroups.com Sent: Tue, May 4,
                                Message 15 of 20 , May 4, 2010
                                • 0 Attachment
                                  terima kasih banyak mas atas masukannya ^-^





                                  ________________________________
                                  From: mul14 <mul14.net@...>
                                  To: id-php@yahoogroups.com
                                  Sent: Tue, May 4, 2010 4:02:32 PM
                                  Subject: Re: [id-php] Membuat Pencarian Data di PHP


                                  Ganti *$cari* jadi *$_POST['cari' ]*;

                                  Ganti *$**txtQword* jadi *$_POST['txtQword' ]*;

                                  On 2010-05-04, hendra hermasnyah <k3nzi_ktd@yahoo. com> wrote:
                                  >
                                  >
                                  >
                                  > file databasenya
                                  >
                                  > CREATE DATABASE dbsimso;
                                  >
                                  > USE `dbsimso`;
                                  >
                                  > CREATE TABLE `mlantaih` (
                                  > `kdlt` varchar(5) NOT NULL,
                                  > `nmlt` varchar(20) DEFAULT NULL,
                                  > `ls` decimal(15,2) DEFAULT NULL,
                                  > PRIMARY KEY (`kdlt`)
                                  > ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
                                  >
                                  > insert into `mlantaih`(` kdlt`,`nmlt` ,`ls`) values
                                  > ('LT002','Semibasem ent','234. 00'),('LT001' ,'Basement' ,'454.00' ),('LT003' ,'Lantai
                                  > Dasar','122. 00'),('LT004' ,'Lantai 1','540.00') ,('LT005' ,'Lantai
                                  > 2','233.00') ;
                                  > ------------ --------- --------- --------- --------- --------- -
                                  > //connectdb. php
                                  > <?
                                  > $dbhost='localhost' ; //local
                                  > $dbusername= 'root';
                                  > $dbuserpassword= '1234';
                                  > $default_dbname= 'dbsimso' ;
                                  >
                                  > $MYSQL_ERRNO= '';
                                  > $MYSQL_ERROR= '';
                                  >
                                  > function db_connect() {
                                  > global $dbhost, $dbusername, $dbuserpassword, $default_dbname;
                                  > global $MYSQL_ERRNO, $MYSQL_ERROR;
                                  > $link_id = mysql_connect( $dbhost, $dbusername, $dbuserpassword) ;
                                  > if(!$link_id) {
                                  > $MYSQL_ERRNO= 0;
                                  > $MYSQL_ERROR= 'Connection failed';
                                  > return 0;
                                  > } elseif (empty($dbname) && !mysql_select_ db($default_ dbname)){
                                  > $MYSQL_ERRNO = mysql_errno( );
                                  > $MYSQL_ERROR = mysql_error( );
                                  > return 0;
                                  > } else return $link_id;
                                  > }
                                  >
                                  > function sql_error() {
                                  > global $MYSQL_ERRNO, $MYSQL_ERROR;
                                  > if(empty($MYSQL_ ERROR)) {
                                  > $MYSQL_ERRNO = mysql_errno( );
                                  > $MYSQL_ERROR = mysql_error( );
                                  > }
                                  > return "$MYSQL_ERRNO : $MYSQL_ERROR" ;
                                  > }
                                  > //end connect_db
                                  >
                                  > error_reporting( 0);
                                  > $link_id = db_connect() ;
                                  > ?>
                                  > ============ ========= ========= ========= ========= ==
                                  > //query.php
                                  > <?
                                  >
                                  > $que_edeposit= "select kdlt, nmlt, ls from mlantaih ";
                                  >
                                  > $query02="select kdlt, nmlt, ls from mlantaih where 1=1 ";
                                  > $default_order_ by2 = ' order by kdlt ';
                                  >
                                  > ?>
                                  > ============ ========= ========= ====
                                  > //caridata.php
                                  > <?
                                  > require_once( "connectdb. php");
                                  > require_once( "query.php" );
                                  > $no=0;
                                  > ?>
                                  > <html>
                                  > <head>
                                  > <title>Daftar Master Lantai</title>
                                  > </head>
                                  >
                                  > <link href="/css/style. css" rel="stylesheet" type="text/css" >
                                  > <body background=" #FFCC00" topmargin="3" leftmargin=" 2">
                                  > <table width="100%" height="98%" border="0" cellpadding= "5" cellspacing= "1"
                                  > align="center" >
                                  > <table width="100%" border="0" cellpadding= "5" cellspacing= "1"
                                  > align="center" >
                                  > <tr>
                                  > <td width="60%">
                                  > <font size="4"><B> Daftar Master Lantai</B></ font>
                                  > </td>
                                  > <td width="20%" align="right" >
                                  > <font color="#008EFF" > </ font>
                                  > </td>
                                  > </tr>
                                  > </table>
                                  >
                                  > <form name=admin action="<?php echo
                                  > $_SERVER['PHP_ SELF?cari= $cari=$cari$ nama=$nama' ] ?>" method="post" >
                                  > <table width="90%" border="0" cellspacing= "3" cellspacing= "0">
                                  > <tr>
                                  > <td>Search By :
                                  > <select name="cari">
                                  > <option value="">All< /option>
                                  > <option value="kode" <? if ($cari=="kode" ) {?> selected <? } ?>
                                  > >Kode</option>
                                  > <option value="nama" <? if ($cari=="nama" ) {?> selected <? } ?>
                                  > >Nama</option>
                                  > </select>
                                  > Keyword :
                                  > <input type="text" name="txtQword" value=<?=$txtQword? >>
                                  > <input type="submit" name="submit" value="Search" class=btn-normal>
                                  > </td>
                                  > </tr>
                                  > </table>
                                  > </form>
                                  >
                                  > <table width="100%" border="0" cellspacing= "0" cellpadding= "0"
                                  > align="center" >
                                  > <tr bgcolor="#FFCC00" ><td><img src="/image/ bluedot11. gif" width="1"
                                  > height="1">< /td></tr>
                                  > </table><br>
                                  > <table width="70%" border="0" cellpadding= "2" cellspacing= "1"
                                  > bgcolor="#FFFF99" >
                                  > <tr bgcolor="9BCB05" >
                                  > <td width="5%">< div align="center" ><b>No.</ b></div>< /td>
                                  > <td width="5%">< div align="center" ><b>Kode Lantai</b></ div></td>
                                  > <td width="25%"> <div align="center" ><b>Nama Lantai</b></ div></td>
                                  > <td width="10%"> <div align="center" ><b>Luas< /b></div> </td>
                                  > </tr>
                                  > <? include "../editmaster. php" ?>
                                  >
                                  > <?
                                  > $no = 0 ;
                                  > $cmd=$query02;
                                  > if ($cari=='kode' ) {
                                  > $filter ="and kdlt like '%$txtQword% ' ";
                                  > }
                                  > elseif ($cari=='nama' ) {
                                  > $filter=" and nmlt like '%$txtQword% ' ";
                                  > }
                                  > else {
                                  > $filter=" ";
                                  > }
                                  >
                                  > $cmd =$query02.$filter. $default_ order_by2 ;
                                  > //echo $cmd;
                                  >
                                  > //echo "AAA $cmd";
                                  > $sql = mysql_query( $cmd, $link_id);
                                  > while ($data=mysql_ fetch_array( $sql)){
                                  > $no++;
                                  > ?>
                                  > <tr bgcolor="#F8F9C3" valign="top" >
                                  > <td align="center" ><div width="center" ><?=$no?> </div></td>
                                  > <td align="center" ><?=$data[ kdlt]?></ td>
                                  > <td><a href="detail. php?id=<? =$data[kdlt] ?>"><?=$data[ nmlt]?></ a></td>
                                  > <td align="center" ><?=$data[ ls]?></td>
                                  > <!--<td align="center" ><?=$status? ></td>-->
                                  > </tr>
                                  > <?
                                  > }
                                  > ?>
                                  > </table>
                                  > </td>
                                  > </tr>
                                  > </table>
                                  > </html>
                                  > ============ ========= ========= ========= ========= ========= ====
                                  > Permasalahannya :
                                  > pada form cari data pas saya klik tombol search dengan kategori Nama Lantai
                                  > misalnya saya Input "b" harusnya yang keluar hanya nama lantai yang
                                  > berawalan atau yang mengandung huruf "b" saja yang muncul,
                                  > apa ada yang kurang dengan coding saya diatas, mohon koreksinya, terima
                                  > kasih
                                  >
                                  > ____________ _________ _________ __
                                  > From: mul14 <mul14.net@gmail. com <mul14.net%40gmail. com>>
                                  > To: id-php@yahoogroups. com <id-php%40yahoogrou ps.com>
                                  > Sent: Tue, May 4, 2010 1:50:49 PM
                                  > Subject: Re: [id-php] Membuat Pencarian Data di PHP
                                  >
                                  > Busyett.. infonya bener2 minim....
                                  >
                                  > Nih kasi contoh satu file. Anggap deh nama table mu person
                                  > ------------ --------- ---
                                  > id | name | address
                                  > ------------ --------- ---
                                  > 1 | kucing | jln buntu
                                  > 2 | kuda | jln aneh
                                  >
                                  > <form method="post" >
                                  > Cari <input type="text" name="carideh" /><input type="submit" />
                                  > </form>
                                  >
                                  > <?php
                                  > if ($_POST) {
                                  > $carideh = $_POST['carideh' ];
                                  > mysql_connect( 'localhost' , 'uname', 'pwd');
                                  > mysql_select_ db('nama_ database_ mu');
                                  > $sql = "SELECT * FROM `person` WHERE `name`='%{$carideh} %' OR
                                  > `address`='% {$carideh} %'";
                                  > $result = mysql_query( $sql);
                                  > echo "<table>";
                                  > while ($row = mysql_fetch_ object($result) )
                                  > {
                                  > echo "<tr>";
                                  > echo "<td>" . $row->name . "</td><td>" . $row->address . "</td>";
                                  > echo "</tr>";
                                  > }
                                  > echo "</table>";
                                  > }
                                  >
                                  > ?>
                                  >
                                  > [Non-text portions of this message have been removed]
                                  >
                                  > [Non-text portions of this message have been removed]
                                  >
                                  >
                                  >

                                  --

                                  facebook.com/ mul14 | twitter.com/ mul14 | koprol.com/users/ mul14 | Yahoo! ID:
                                  phpmutant
                                  Indonesian Web Framework Community - http://framework. web.id
                                  Jogja Startup Community: bancakan.org

                                  --

                                  [Non-text portions of this message have been removed]







                                  [Non-text portions of this message have been removed]
                                • bondan sentanu
                                  ... ini topiknya tentang sql injection yah?? (ga nyambung mode) coba mas kenzi ganti $query02= select kdlt, nmlt, ls from mlantaih where 1=1 ; jadi ini :
                                  Message 16 of 20 , May 4, 2010
                                  • 0 Attachment
                                    >From: Bobby Nugraha Ariffin <zzee_bob@...>
                                    >To: id-php@yahoogroups.com
                                    >Sent: Tue, May 4, 2010 2:07:39 AM
                                    >Subject: Bls: [id-php] Membuat Pencarian Data di PHP
                                    >
                                    >kok ada where 1=1 ? kalo gini semua data bakal keluar...

                                    ini topiknya tentang sql injection yah?? (ga nyambung mode)

                                    coba mas kenzi ganti

                                    $query02="select kdlt, nmlt, ls from mlantaih where 1=1 ";

                                    jadi ini :

                                    $query02="select kdlt, nmlt, ls from mlantaih where kdlt LIKE '%".$_POST['txtQword']."%' OR nmlt LIKE '%".$_POST['txtQword']."%'";

                                    persis kaya contoh pertama mas mulia yang sdi bawah banget..

                                    >coba baca2 lagi tentang Query LIKE di MySql

                                    iya betul..
                                    coba cari di web untuk teknik pencarian di web
                                    (wow infinite loop detected)

                                    gak usah buru2 yang sabar aja baca2nya..

                                    >>my blog...
                                    >>bahasa: http://bob.web. id/
                                    >>english: http://seekbob. com/
                                    >
                                    >>____________ _________ _________ __
                                    >>Dari: hendra hermasnyah <k3nzi_ktd@yahoo. com>
                                    >>Kepada: id-php@yahoogroups. com
                                    >>Terkirim: Sel, 4 Mei, 2010 15:09:01
                                    >>Judul: Re: [id-php] Membuat Pencarian Data di PHP
                                    >
                                    >>file databasenya
                                    >
                                    >>CREATE DATABASE dbsimso;
                                    >
                                    >>USE `dbsimso`;
                                    >
                                    >>CREATE TABLE `mlantaih` (
                                    >>`kdlt` varchar(5) NOT NULL,
                                    >>`nmlt` varchar(20) DEFAULT NULL,
                                    >>`ls` decimal(15,2) DEFAULT NULL,
                                    >>PRIMARY KEY (`kdlt`)
                                    >>) ENGINE=MyISAM DEFAULT CHARSET=utf8;
                                    >
                                    >>insert into `mlantaih`(` kdlt`,`nmlt` ,`ls`) values ('LT002','Semibasem ent','234. 00'),('LT001' ,'Basement' ,'454.00' ),('LT003' ,'Lantai Dasar','122. 00'),('LT004' ,'Lantai 1','540.00') ,('LT005' ,'Lantai 2','233.00') ;
                                    >>------------ --------- --------- --------- --------- --------- -
                                    >>//connectdb. php
                                    >><?
                                    >>$dbhost='localhost' ; //local
                                    >>$dbusername= 'root';
                                    >>$dbuserpassword= '1234';
                                    >>$default_dbname= 'dbsimso' ;
                                    >
                                    >>$MYSQL_ERRNO= '';
                                    >>$MYSQL_ERROR= '';
                                    >
                                    >>function db_connect() {
                                    >>global $dbhost, $dbusername, $dbuserpassword, $default_dbname;
                                    >>global $MYSQL_ERRNO, $MYSQL_ERROR;
                                    >>$link_id = mysql_connect( $dbhost, $dbusername, $dbuserpassword) ;
                                    >>if(!$link_id) {
                                    >>$MYSQL_ERRNO= 0;
                                    >>$MYSQL_ERROR= 'Connection failed';
                                    >>return 0;
                                    >>} elseif (empty($dbname) && !mysql_select_ db($default_ dbname)){
                                    >>$MYSQL_ERRNO = mysql_errno( );
                                    >>$MYSQL_ERROR = mysql_error( );
                                    >>return 0;
                                    >>} else return $link_id;
                                    >>}
                                    >
                                    >>function sql_error() {
                                    >>global $MYSQL_ERRNO, $MYSQL_ERROR;
                                    >>if(empty($MYSQL_ ERROR)) {
                                    >>$MYSQL_ERRNO = mysql_errno( );
                                    >>$MYSQL_ERROR = mysql_error( );
                                    >>}
                                    >>return "$MYSQL_ERRNO : $MYSQL_ERROR" ;
                                    >>}
                                    >>//end connect_db
                                    >
                                    >>error_reporting( 0);
                                    >>$link_id = db_connect() ;
                                    >>?>
                                    >>============ ========= ========= ========= ========= ==
                                    >>//query.php
                                    >><?
                                    >
                                    >>$que_edeposit= "select kdlt, nmlt, ls from mlantaih ";
                                    >
                                    >>$query02="select kdlt, nmlt, ls from mlantaih where 1=1 ";
                                    >>$default_order_ by2 = ' order by kdlt ';
                                    >
                                    >>?>
                                    >>============ ========= ========= ====
                                    >>//caridata.php
                                    >><?
                                    >>require_once( "connectdb. php");
                                    >>require_once( "query.php" );
                                    >>$no=0;
                                    >>?>
                                    >><html>
                                    >><head>
                                    >><title>Daftar Master Lantai</title>
                                    >></head>
                                    >
                                    >><link href="/css/style. css" rel="stylesheet" type="text/css" >
                                    >><body background=" #FFCC00" topmargin="3" leftmargin=" 2">
                                    >><table width="100%" height="98%" border="0" cellpadding= "5" cellspacing= "1" align="center" >
                                    >><table width="100%" border="0" cellpadding= "5" cellspacing= "1" align="center" >
                                    >><tr>
                                    >><td width="60%">
                                    >><font size="4"><B> Daftar Master Lantai</B></ font>
                                    >></td>
                                    >><td width="20%" align="right" >
                                    >><font color="#008EFF" > </ font>
                                    >></td>
                                    >></tr>
                                    >></table>
                                    >
                                    >><form name=admin action="<?php echo $_SERVER['PHP_ SELF?cari= $cari=$cari$ nama=$nama' ] ?>" method="post" >
                                    >><table width="90%" border="0" cellspacing= "3" cellspacing= "0">
                                    >><tr>
                                    >><td>Search By :
                                    >><select name="cari">
                                    >><option value="">All< /option>
                                    >><option value="kode" <? if ($cari=="kode" ) {?> selected <? } ?> >Kode</option>
                                    >><option value="nama" <? if ($cari=="nama" ) {?> selected <? } ?> >Nama</option>
                                    >></select>
                                    >>Keyword :
                                    >><input type="text" name="txtQword" value=<?=$txtQword? >>
                                    >><input type="submit" name="submit" value="Search" class=btn-normal>
                                    >></td>
                                    >></tr>
                                    >></table>
                                    >></form>
                                    >
                                    >><table width="100%" border="0" cellspacing= "0" cellpadding= "0" align="center" >
                                    >><tr bgcolor="#FFCC00" ><td><img src="/image/ bluedot11. gif" width="1" height="1">< /td></tr>
                                    >></table><br>
                                    >><table width="70%" border="0" cellpadding= "2" cellspacing= "1" bgcolor="#FFFF99" >
                                    >><tr bgcolor="9BCB05" >
                                    >><td width="5%">< div align="center" ><b>No.</ b></div>< /td>
                                    >><td width="5%">< div align="center" ><b>Kode Lantai</b></ div></td>
                                    >><td width="25%"> <div align="center" ><b>Nama Lantai</b></ div></td>
                                    >><td width="10%"> <div align="center" ><b>Luas< /b></div> </td>
                                    >></tr>
                                    >><? include "../editmaster. php" ?>
                                    >
                                    >><?
                                    >>$no = 0 ;
                                    >>$cmd=$query02;
                                    >>if ($cari=='kode' ) {
                                    >>$filter ="and kdlt like '%$txtQword% ' ";
                                    >>}
                                    >>elseif ($cari=='nama' ) {
                                    >>$filter=" and nmlt like '%$txtQword% ' ";
                                    >>}
                                    >>else {
                                    >>$filter=" ";
                                    >>}
                                    >
                                    >>$cmd =$query02.$filter. $default_ order_by2 ;
                                    >>//echo $cmd;
                                    >
                                    >>//echo "AAA $cmd";
                                    >>$sql = mysql_query( $cmd, $link_id);
                                    >>while ($data=mysql_ fetch_array( $sql)){
                                    >>$no++;
                                    >>?>
                                    >><tr bgcolor="#F8F9C3" valign="top" >
                                    >><td align="center" ><div width="center" ><?=$no?> </div></td>
                                    >><td align="center" ><?=$data[ kdlt]?></ td>
                                    >><td><a href="detail. php?id=<? =$data[kdlt] ?>"><?=$data[ nmlt]?></ a></td>
                                    >><td align="center" ><?=$data[ ls]?></td>
                                    >><!--<td align="center" ><?=$status? ></td>-->
                                    >></tr>
                                    >><?
                                    >>}
                                    >>?>
                                    >></table>
                                    >></td>
                                    >></tr>
                                    >></table>
                                    >></html>
                                    >>============ ========= ========= ========= ========= ========= ====
                                    >>Permasalahannya :
                                    >>pada form cari data pas saya klik tombol search dengan kategori Nama Lantai misalnya saya Input "b" harusnya yang keluar hanya nama lantai yang berawalan atau yang mengandung huruf "b" saja yang muncul,
                                    >>apa ada yang kurang dengan coding saya diatas, mohon koreksinya, terima kasih
                                    >
                                    >>____________ _________ _________ __
                                    >>From: mul14 <mul14.net@gmail. com>
                                    >>To: id-php@yahoogroups. com
                                    >>Sent: Tue, May 4, 2010 1:50:49 PM
                                    >>Subject: Re: [id-php] Membuat Pencarian Data di PHP
                                    >
                                    >>Busyett.. infonya bener2 minim....
                                    >
                                    >>Nih kasi contoh satu file. Anggap deh nama table mu person
                                    >>------------ --------- ---
                                    >>id | name | address
                                    >>------------ --------- ---
                                    >>1 | kucing | jln buntu
                                    >>2 | kuda | jln aneh
                                    >
                                    >><form method="post" >
                                    >>Cari <input type="text" name="carideh" /><input type="submit" />
                                    >></form>
                                    >
                                    >><?php
                                    >>if ($_POST) {
                                    >>$carideh = $_POST['carideh' ];
                                    >>mysql_connect( 'localhost' , 'uname', 'pwd');
                                    >>mysql_select_ db('nama_ database_ mu');
                                    >>$sql = "SELECT * FROM `person` WHERE `name`='%{$carideh} %' OR
                                    >>`address`='% {$carideh} %'";
                                    >>$result = mysql_query( $sql);
                                    >>echo "<table>";
                                    >>while ($row = mysql_fetch_ object($result) )
                                    >>{
                                    >>echo "<tr>";
                                    >>echo "<td>" . $row->name . "</td><td>" . $row->address . "</td>";
                                    >>echo "</tr>";
                                    >>}
                                    >>echo "</table>";
                                    >>}
                                    >
                                    >>?>
                                    >
                                    >>[Non-text portions of this message have been removed]
                                    >
                                    >>[Non-text portions of this message have been removed]
                                    >
                                    >>[Non-text portions of this message have been removed]
                                    >
                                    >
                                    >
                                  • Wida
                                    sekedar masukan, kalo bikin tabel, kasi nama tabel dan nama kolomnya yang berarti dan mudah dibaca kalo penamaannya bagus, query yang dibuat akan seperti
                                    Message 17 of 20 , May 4, 2010
                                    • 0 Attachment
                                      sekedar masukan,
                                      kalo bikin tabel, kasi nama tabel dan nama kolomnya yang
                                      berarti dan mudah dibaca

                                      kalo penamaannya bagus,
                                      query yang dibuat akan seperti kalimat bahasa inggris biasa
                                      ini akan mempermudah anda, jika anda harus merevisi
                                      query atau coding yang harus diubah setelah aplikasi selesai
                                      akan mempermudah orang lain yang meneruskan pekerjaan anda juga
                                      kalo-kalo anda resign atau apalah, sehingga pekerjaan lanjutan
                                      akan lebih mudah dipahami dan cepat selesai

                                      misal, instead of
                                      CREATE TABLE `mlantaih` (
                                      `kdlt` varchar(5) NOT NULL,
                                      `nmlt` varchar(20) DEFAULT NULL,
                                      `ls` decimal(15,2) DEFAULT NULL,
                                      PRIMARY KEY (`kdlt`)
                                      ) ENGINE=MyISAM DEFAULT CHARSET=utf8;

                                      akan lebih baik jika
                                      CREATE TABLE `lantai` (
                                      `kode_lantai` varchar(5) NOT NULL,
                                      `nama_lantai` varchar(20) DEFAULT NULL,
                                      `luas_lantai` decimal(15,2) DEFAULT NULL,
                                      PRIMARY KEY (`kode_lantai`)
                                      ) ENGINE=MyISAM DEFAULT CHARSET=utf8;

                                      daripada
                                      select kdlt, nmlt from mlaintaih

                                      lebih baik
                                      select kode_lantai, nama_lantai from lantai
                                      (ambil data kode lantai dan nama lantai dari tabel lantai)

                                      hal ini berlaku juga untuk penamaan variabel di codingan

                                      ~wida

                                      --- In id-php@yahoogroups.com, hendra hermasnyah <k3nzi_ktd@...> wrote:
                                      >
                                      > terima kasih banyak mas atas masukannya ^-^
                                      >
                                      >
                                      >
                                      >
                                      >
                                      > ________________________________
                                      > From: mul14 <mul14.net@...>
                                      > To: id-php@yahoogroups.com
                                      > Sent: Tue, May 4, 2010 4:02:32 PM
                                      > Subject: Re: [id-php] Membuat Pencarian Data di PHP
                                      >
                                      >
                                      > Ganti *$cari* jadi *$_POST['cari' ]*;
                                      >
                                      > Ganti *$**txtQword* jadi *$_POST['txtQword' ]*;
                                      >
                                      > On 2010-05-04, hendra hermasnyah <k3nzi_ktd@yahoo. com> wrote:
                                      > >
                                      > >
                                      > >
                                      > > file databasenya
                                      > >
                                      > > CREATE DATABASE dbsimso;
                                      > >
                                      > > USE `dbsimso`;
                                      > >
                                      > > CREATE TABLE `mlantaih` (
                                      > > `kdlt` varchar(5) NOT NULL,
                                      > > `nmlt` varchar(20) DEFAULT NULL,
                                      > > `ls` decimal(15,2) DEFAULT NULL,
                                      > > PRIMARY KEY (`kdlt`)
                                      > > ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
                                      > >
                                      > > insert into `mlantaih`(` kdlt`,`nmlt` ,`ls`) values
                                      > > ('LT002','Semibasem ent','234. 00'),('LT001' ,'Basement' ,'454.00' ),('LT003' ,'Lantai
                                      > > Dasar','122. 00'),('LT004' ,'Lantai 1','540.00') ,('LT005' ,'Lantai
                                      > > 2','233.00') ;
                                      > > ------------ --------- --------- --------- --------- --------- -
                                      > > //connectdb. php
                                      > > <?
                                      > > $dbhost='localhost' ; //local
                                      > > $dbusername= 'root';
                                      > > $dbuserpassword= '1234';
                                      > > $default_dbname= 'dbsimso' ;
                                      > >
                                      > > $MYSQL_ERRNO= '';
                                      > > $MYSQL_ERROR= '';
                                      > >
                                      > > function db_connect() {
                                      > > global $dbhost, $dbusername, $dbuserpassword, $default_dbname;
                                      > > global $MYSQL_ERRNO, $MYSQL_ERROR;
                                      > > $link_id = mysql_connect( $dbhost, $dbusername, $dbuserpassword) ;
                                      > > if(!$link_id) {
                                      > > $MYSQL_ERRNO= 0;
                                      > > $MYSQL_ERROR= 'Connection failed';
                                      > > return 0;
                                      > > } elseif (empty($dbname) && !mysql_select_ db($default_ dbname)){
                                      > > $MYSQL_ERRNO = mysql_errno( );
                                      > > $MYSQL_ERROR = mysql_error( );
                                      > > return 0;
                                      > > } else return $link_id;
                                      > > }
                                      > >
                                      > > function sql_error() {
                                      > > global $MYSQL_ERRNO, $MYSQL_ERROR;
                                      > > if(empty($MYSQL_ ERROR)) {
                                      > > $MYSQL_ERRNO = mysql_errno( );
                                      > > $MYSQL_ERROR = mysql_error( );
                                      > > }
                                      > > return "$MYSQL_ERRNO : $MYSQL_ERROR" ;
                                      > > }
                                      > > //end connect_db
                                      > >
                                      > > error_reporting( 0);
                                      > > $link_id = db_connect() ;
                                      > > ?>
                                      > > ============ ========= ========= ========= ========= ==
                                      > > //query.php
                                      > > <?
                                      > >
                                      > > $que_edeposit= "select kdlt, nmlt, ls from mlantaih ";
                                      > >
                                      > > $query02="select kdlt, nmlt, ls from mlantaih where 1=1 ";
                                      > > $default_order_ by2 = ' order by kdlt ';
                                      > >
                                      > > ?>
                                      > > ============ ========= ========= ====
                                      > > //caridata.php
                                      > > <?
                                      > > require_once( "connectdb. php");
                                      > > require_once( "query.php" );
                                      > > $no=0;
                                      > > ?>
                                      > > <html>
                                      > > <head>
                                      > > <title>Daftar Master Lantai</title>
                                      > > </head>
                                      > >
                                      > > <link href="/css/style. css" rel="stylesheet" type="text/css" >
                                      > > <body background=" #FFCC00" topmargin="3" leftmargin=" 2">
                                      > > <table width="100%" height="98%" border="0" cellpadding= "5" cellspacing= "1"
                                      > > align="center" >
                                      > > <table width="100%" border="0" cellpadding= "5" cellspacing= "1"
                                      > > align="center" >
                                      > > <tr>
                                      > > <td width="60%">
                                      > > <font size="4"><B> Daftar Master Lantai</B></ font>
                                      > > </td>
                                      > > <td width="20%" align="right" >
                                      > > <font color="#008EFF" > </ font>
                                      > > </td>
                                      > > </tr>
                                      > > </table>
                                      > >
                                      > > <form name=admin action="<?php echo
                                      > > $_SERVER['PHP_ SELF?cari= $cari=$cari$ nama=$nama' ] ?>" method="post" >
                                      > > <table width="90%" border="0" cellspacing= "3" cellspacing= "0">
                                      > > <tr>
                                      > > <td>Search By :
                                      > > <select name="cari">
                                      > > <option value="">All< /option>
                                      > > <option value="kode" <? if ($cari=="kode" ) {?> selected <? } ?>
                                      > > >Kode</option>
                                      > > <option value="nama" <? if ($cari=="nama" ) {?> selected <? } ?>
                                      > > >Nama</option>
                                      > > </select>
                                      > > Keyword :
                                      > > <input type="text" name="txtQword" value=<?=$txtQword? >>
                                      > > <input type="submit" name="submit" value="Search" class=btn-normal>
                                      > > </td>
                                      > > </tr>
                                      > > </table>
                                      > > </form>
                                      > >
                                      > > <table width="100%" border="0" cellspacing= "0" cellpadding= "0"
                                      > > align="center" >
                                      > > <tr bgcolor="#FFCC00" ><td><img src="/image/ bluedot11. gif" width="1"
                                      > > height="1">< /td></tr>
                                      > > </table><br>
                                      > > <table width="70%" border="0" cellpadding= "2" cellspacing= "1"
                                      > > bgcolor="#FFFF99" >
                                      > > <tr bgcolor="9BCB05" >
                                      > > <td width="5%">< div align="center" ><b>No.</ b></div>< /td>
                                      > > <td width="5%">< div align="center" ><b>Kode Lantai</b></ div></td>
                                      > > <td width="25%"> <div align="center" ><b>Nama Lantai</b></ div></td>
                                      > > <td width="10%"> <div align="center" ><b>Luas< /b></div> </td>
                                      > > </tr>
                                      > > <? include "../editmaster. php" ?>
                                      > >
                                      > > <?
                                      > > $no = 0 ;
                                      > > $cmd=$query02;
                                      > > if ($cari=='kode' ) {
                                      > > $filter ="and kdlt like '%$txtQword% ' ";
                                      > > }
                                      > > elseif ($cari=='nama' ) {
                                      > > $filter=" and nmlt like '%$txtQword% ' ";
                                      > > }
                                      > > else {
                                      > > $filter=" ";
                                      > > }
                                      > >
                                      > > $cmd =$query02.$filter. $default_ order_by2 ;
                                      > > //echo $cmd;
                                      > >
                                      > > //echo "AAA $cmd";
                                      > > $sql = mysql_query( $cmd, $link_id);
                                      > > while ($data=mysql_ fetch_array( $sql)){
                                      > > $no++;
                                      > > ?>
                                      > > <tr bgcolor="#F8F9C3" valign="top" >
                                      > > <td align="center" ><div width="center" ><?=$no?> </div></td>
                                      > > <td align="center" ><?=$data[ kdlt]?></ td>
                                      > > <td><a href="detail. php?id=<? =$data[kdlt] ?>"><?=$data[ nmlt]?></ a></td>
                                      > > <td align="center" ><?=$data[ ls]?></td>
                                      > > <!--<td align="center" ><?=$status? ></td>-->
                                      > > </tr>
                                      > > <?
                                      > > }
                                      > > ?>
                                      > > </table>
                                      > > </td>
                                      > > </tr>
                                      > > </table>
                                      > > </html>
                                      > > ============ ========= ========= ========= ========= ========= ====
                                      > > Permasalahannya :
                                      > > pada form cari data pas saya klik tombol search dengan kategori Nama Lantai
                                      > > misalnya saya Input "b" harusnya yang keluar hanya nama lantai yang
                                      > > berawalan atau yang mengandung huruf "b" saja yang muncul,
                                      > > apa ada yang kurang dengan coding saya diatas, mohon koreksinya, terima
                                      > > kasih
                                      > >
                                      > > ____________ _________ _________ __
                                      > > From: mul14 <mul14.net@gmail. com <mul14.net%40gmail. com>>
                                      > > To: id-php@yahoogroups. com <id-php%40yahoogrou ps.com>
                                      > > Sent: Tue, May 4, 2010 1:50:49 PM
                                      > > Subject: Re: [id-php] Membuat Pencarian Data di PHP
                                      > >
                                      > > Busyett.. infonya bener2 minim....
                                      > >
                                      > > Nih kasi contoh satu file. Anggap deh nama table mu person
                                      > > ------------ --------- ---
                                      > > id | name | address
                                      > > ------------ --------- ---
                                      > > 1 | kucing | jln buntu
                                      > > 2 | kuda | jln aneh
                                      > >
                                      > > <form method="post" >
                                      > > Cari <input type="text" name="carideh" /><input type="submit" />
                                      > > </form>
                                      > >
                                      > > <?php
                                      > > if ($_POST) {
                                      > > $carideh = $_POST['carideh' ];
                                      > > mysql_connect( 'localhost' , 'uname', 'pwd');
                                      > > mysql_select_ db('nama_ database_ mu');
                                      > > $sql = "SELECT * FROM `person` WHERE `name`='%{$carideh} %' OR
                                      > > `address`='% {$carideh} %'";
                                      > > $result = mysql_query( $sql);
                                      > > echo "<table>";
                                      > > while ($row = mysql_fetch_ object($result) )
                                      > > {
                                      > > echo "<tr>";
                                      > > echo "<td>" . $row->name . "</td><td>" . $row->address . "</td>";
                                      > > echo "</tr>";
                                      > > }
                                      > > echo "</table>";
                                      > > }
                                      > >
                                      > > ?>
                                      > >
                                      > > [Non-text portions of this message have been removed]
                                      > >
                                      > > [Non-text portions of this message have been removed]
                                      > >
                                      > >
                                      > >
                                      >
                                      > --
                                      >
                                      > facebook.com/ mul14 | twitter.com/ mul14 | koprol.com/users/ mul14 | Yahoo! ID:
                                      > phpmutant
                                      > Indonesian Web Framework Community - http://framework. web.id
                                      > Jogja Startup Community: bancakan.org
                                      >
                                      > --
                                      >
                                      > [Non-text portions of this message have been removed]
                                      >
                                      >
                                      >
                                      >
                                      >
                                      >
                                      >
                                      > [Non-text portions of this message have been removed]
                                      >
                                    • mul14
                                      OOT: Kebetulan tadi baca ini How To Ask Questions The Smart Way . ... Buat TS (atau siapapun), lain kali kalau
                                      Message 18 of 20 , May 5, 2010
                                      • 0 Attachment
                                        OOT:
                                        Kebetulan tadi baca ini How To Ask Questions The Smart
                                        Way<http://catb.org/~esr/faqs/smart-questions.html>
                                        .

                                        >
                                        Buat TS (atau siapapun), lain kali kalau pertanyaannya nggak jelas, saya
                                        (mungkin juga yang lain) nggak akan membantu.


                                        [Non-text portions of this message have been removed]
                                      Your message has been successfully submitted and would be delivered to recipients shortly.