[PHP] Search functionality in website.

2008-12-29 Thread Tiji varghese
Hi all,I would like to set up search functionality on my website. I'm using PHP 
and Mysql. Most of the pages contain static text in the html and is not 
database driven. I need some idea on how should I go about it without moving 
everything to database driven functionality. Please help.Thanks in advance! 


  Add more friends to your messenger and enjoy! Go to 
http://messenger.yahoo.com/invite/

Re: [PHP] Search functionality in website.

2008-12-29 Thread Miles Thompson
On Mon, Dec 29, 2008 at 10:47 AM, Tiji varghese tij...@yahoo.co.in wrote:

 Hi all,I would like to set up search functionality on my website. I'm using
 PHP and Mysql. Most of the pages contain static text in the html and is not
 database driven. I need some idea on how should I go about it without moving
 everything to database driven functionality. Please help.Thanks in advance!


  Add more friends to your messenger and enjoy! Go to
 http://messenger.yahoo.com/invite/


ht-dig (or digg)


Re: [PHP] Search functionality in website.

2008-12-29 Thread John Corry
Or even a google search widget...

Miles Thompson wrote:
 On Mon, Dec 29, 2008 at 10:47 AM, Tiji varghese tij...@yahoo.co.in wrote:

 ht-dig (or digg)
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Search functionality in website.

2008-12-29 Thread Richard Heyes
 Hi all,I would like to set up search functionality on my website. I'm using 
 PHP and Mysql. Most
 of the pages contain static text in the html and is not database driven. I 
 need some idea on how
 should I go about it without moving everything to database driven 
 functionality.

You could look into using Zend_Search_Lucene (part of the Zend
framework). Never used it myself, but from what I've read about it, it
looks quite good (plus it's file based, ie. you don't need MySQL).
There's also the Google search widget like I use on my personal
website: http://www.phpguru.org

-- 
Richard Heyes

HTML5 Graphing for FF, Chrome, Opera and Safari:
http://www.rgraph.org (Updated December 20th)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Search functionality in website.

2008-12-29 Thread tedd

At 8:17 PM +0530 12/29/08, Tiji varghese wrote:
Hi all,I would like to set up search functionality on my website. 
I'm using PHP and Mysql. Most of the pages contain static text in 
the html and is not database driven. I need some idea on how should 
I go about it without moving everything to database driven 
functionality. Please help.Thanks in advance!


Try:

http://sperling.com/examples/search/

Cheers,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Search functionality

2008-09-24 Thread Dan Shirah

   Its pretty straight forward, you create a query that extracts the name
 and id of the records with a relevant where clause created on the fly. When
 outputing the data, each record gets created as a link that then loads
 another page/div with the total dataset for that record. The question for
 you is how you want the interface for the search to work. You can provide a
 dropdown with some choices (date, zip, etc) and a text input / date input
 picker to allow the user to enter the data. This then gets submitted and
 runs the query



Correct, right now each record is displayed on the screen as a link.  When
the link is clicked a query runs to pull all of the related data and
displays it as a subset of items under the main link.

The problem is, since I am not pulling all of the detail when I run the
initial query, what would be the best way to find the search results when
they will most liely be contained in the data I did not initially pull.


Re: [PHP] Search functionality

2008-09-24 Thread Bastien Koert
On Wed, Sep 24, 2008 at 4:47 PM, Dan Shirah [EMAIL PROTECTED] wrote:

   Its pretty straight forward, you create a query that extracts the name
 and id of the records with a relevant where clause created on the fly. When
 outputing the data, each record gets created as a link that then loads
 another page/div with the total dataset for that record. The question for
 you is how you want the interface for the search to work. You can provide a
 dropdown with some choices (date, zip, etc) and a text input / date input
 picker to allow the user to enter the data. This then gets submitted and
 runs the query



 Correct, right now each record is displayed on the screen as a link.  When
 the link is clicked a query runs to pull all of the related data and
 displays it as a subset of items under the main link.

 The problem is, since I am not pulling all of the detail when I run the
 initial query, what would be the best way to find the search results when
 they will most liely be contained in the data I did not initially pull.



 Pass the search criteria previously entered thru session or hidden fields
or in the url along with the id to further refine the search


-- 

Bastien

Cat, the other other white meat


[PHP] Search functionality

2008-09-22 Thread Dan Shirah
Hello all,

I'm looking for suggestions on how to create a search function within my
application.  First I'll give you an overview.

At the top of my page I have a form that contains name and date fields.
When a user puts in some data and selects Search a simple column of
results will be displayed on the left side of the screen.

Example:

User searchs for a date of 09/22/08 and a name of Customers. In the left
column a list of all customers for that day will be generated.  There is A
LOT of detail associated with these customer results therefore all data such
as name, address, zip code, order number etc is not pulled from the database
upon initial search.  Instead, if a user clicks a customer name a seperate
query will run and retrieve all of the pertinent data and provide a bulleted
list under the customer name.

What my vendor wants me to do is provide a way for someone to search through
all the customers including the details that I do not initially display to
allow them to find specific data.  Such as finiding a record with a specific
zip code.  They then want to be able to click next to go to each consecutive
record with that zip code.

Any ideas on how to do this since all that data is not initially pulled in?


Re: [PHP] Search functionality

2008-09-22 Thread Bastien Koert
On Mon, Sep 22, 2008 at 4:07 PM, Dan Shirah [EMAIL PROTECTED] wrote:

 Hello all,

 I'm looking for suggestions on how to create a search function within my
 application.  First I'll give you an overview.

 At the top of my page I have a form that contains name and date fields.
 When a user puts in some data and selects Search a simple column of
 results will be displayed on the left side of the screen.

 Example:

 User searchs for a date of 09/22/08 and a name of Customers. In the
 left
 column a list of all customers for that day will be generated.  There is A
 LOT of detail associated with these customer results therefore all data
 such
 as name, address, zip code, order number etc is not pulled from the
 database
 upon initial search.  Instead, if a user clicks a customer name a seperate
 query will run and retrieve all of the pertinent data and provide a
 bulleted
 list under the customer name.

 What my vendor wants me to do is provide a way for someone to search
 through
 all the customers including the details that I do not initially display to
 allow them to find specific data.  Such as finiding a record with a
 specific
 zip code.  They then want to be able to click next to go to each
 consecutive
 record with that zip code.

 Any ideas on how to do this since all that data is not initially pulled in?


Its pretty straight forward, you create a query that extracts the name and
id of the records with a relevant where clause created on the fly. When
outputing the data, each record gets created as a link that then loads
another page/div with the total dataset for that record. The question for
you is how you want the interface for the search to work. You can provide a
dropdown with some choices (date, zip, etc) and a text input / date input
picker to allow the user to enter the data. This then gets submitted and
runs the query

?php

//ignoring all the little details like data validation which you need to put
in

$query_type = $_POST['query_type'];  // zip, date, (text value of the
dropdown)

$param   = $_POST['param'];

$sql = select cus_id, cus_name from customers where 1 ;

if(!empty($query_type)){
  //use this to point to the correct field in the table
  switch strtolower($query_type){
case date:
  $field =  join_date ;
  $param = (strtotime($param) !== false ) ? ' . date(Y-m-d,
strtotime($param)) . '  : date(Y-m-d) ;  //ternary check on date if
strtotime doesn't fail
  break;

   case zip:
 $field =  zip ;
 $param = (int)$param;  //force to int for US 5 digit zip, could also
use regex if you know what country you are operating in
 break;

   //add more case statements based on the element you want to allow

}

if (!empty($param)){
  $sql .=  and $field = $param ;
}

//skipping the mysql connection stuff

$result = mysql_query($sql);

if ( mysql_errno != 0 )
{
//query went wrong so handle it
   die(Bad query!);
}

if (mysql_num_rows($result)  0 )
{
  while ($rows = mysql_fetch_array($result)){
echo a
href='getDetail.php?id={$rows['cus_id']}'{$rows['cus_name']}/abr/;
  }

}else{
  echo No results;
}

?

or something like that
-- 

Bastien

Cat, the other other white meat