Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Re: How to place Search Results!!!

by ACJavascript (Acolyte)
on Aug 15, 2003 at 20:01 UTC ( [id://284246]=note: print w/replies, xml ) Need Help??


in reply to Re: How to place Search Results!!!
in thread How to place Search Results!!!

Hey sgifford, The code you presented gave me some errors. But i think I know were your going with it.

I was thinking. Would this work.

1. User Types in string.
2. The string is checked searchs through the database. 3. Any results are then pushed into a Hash or Array 4. Then the array (hash) is sorted by least price. 5. then printed out.

Would that work??

A*C

Replies are listed 'Best First'.
Re: Re: Re: How to place Search Results!!!
by sgifford (Prior) on Aug 16, 2003 at 17:31 UTC

    That's odd that it gave you errors. I just re-ran it, and it worked fine.

    Anyways, yes, I think what you're thinking will work.

    If your flat-file database gets very large, you'll want to look at using a db or dbm database, or maybe SQL. Searches will get slower as the number of items in the flatfile grows.

      hello again, Okay,, One problem hehehe,, How can I sort it lol
      HELP!!! lol

        Do you mean how can you sort a DBM/DB database? Well, with Berkeley DB you can create a BTree database, which is sorted on some key. Otherwise, you can create a database keyed on the field you want to sort by, then extract all of the keys from the DB with keys, sort the keys, then retreive the entries in the right order based on that.

        With SQL, you'd simply use an ORDER BY clause.

        But you shouldn't have to worry about that unless you have a large number of records.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://284246]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2024-07-24 10:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.