Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // koneksi.php
- $cn = mysql_connect("host","root","");
- mysql_select_db("db",$cn);
- ?>
- <?php // form_search.php ?>
- <form action="url" method="post">
- <input type="text" name="q" id="q"/>
- <input type="submit" name="cari" id="cari" value="cari"/>
- </form>
- <?php
- // search.php
- include "koneksi.php";
- include "form_search.php";
- $q=mysql_query("SELECT * FROM mytable WHERE myfield LIKE '%".$_POST["q"]."%'");
- while($r=mysql_fetch_array($q)){
- echo $r["myfield"];
- // or
- echo $r[1].$r[2].$r[3];
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement