Custom Search

News World

May 17, 2011

Create a Simple Search Engine Page via PHP Script

1
2
3 --------------------------------------------------
4 Create file stl.css in to "geology" folder
5 --------------------------------------------------
6
7
8 copy the script below to stl.css
9 --------------------------------------------------
10
11
12 < form name='frm_se' method='POST' action='' >
13 < input name= 'txt_se' type=text size='15' value='' style='border-style:solid; border-width:1; font-family: Arial; font-size: 8pt; height:20px;
14 width:8pc;border-color:#808080;padding-left:2px;' >
15 < input name= 'btn_se' type = 'submit' value='Search' style='border-style:solid; border-width:1; font-family: Arial; font-size: 11px; height:20px;
16 width:4pc;border-color:#808080;text-align: center; vertical-align:top;' >
17 < /form >
18
19 < ? php
20 $db_hname = "localhost";
21 $db_uname = "root";
22 $db_pword = "";
23 $db_name = "eod";
24 $link = mysql_connect($db_hname, $db_uname, $db_pword) or die("Not Success ....!");
25 if (!$link) { die('Could not connect: ' . mysql_error()); }
26 mysql_select_db($db_name);
27
28 if($_POST['btn_se']){
29 // idp kprod nprod hprod sprod gprod tprod pstatus pview pstock
30 $sr = $_POST['txt_se'];
31 // --------------------------------------------------------------------------------
32 $stb_db = mysql_query("select * from tbproduk where kprod LIKE '%".$sr."%'
or nprod LIKE '%".$sr."%' or hprod LIKE '%".$sr."%' or sprod LIKE '%".$sr."%'");
33 $rstb_db = mysql_num_rows($stb_db);
34 for ($i=1;$i< =$rstb_db;$i++){
35 $dtstb_db = mysql_fetch_array($stb_db);
36
37 echo 'Product Code : '.$dtstb_db['kprod'].'< br >';
38 echo 'Product Name : '.$dtstb_db['nprod'].'< br >';
39 echo 'Product Price : '.$dtstb_db['hprod'].'< br >';
40 echo 'Product Stock : '.$dtstb_db['sprod'].'< br >';
41 echo '< hr >';
42
43 }
44
45 }
46 ? >

1 comment:

Anonymous said...

Thank you very much for script that you create on this site. My problem solves.

IT Conversations

Moneycontrol Latest News

Latest new pages on Computer Hope

Latest from Infoworld

Door Lock

Door Lock Import Top Door Lock from China Contact Quality Manufacturers Now