Beefy Boxes and Bandwidth Generously Provided by pair Networks vroom
Just another Perl shrine
 
PerlMonks  

Re: Performing queries with DBI and DBD::MySQL

by dbwiz (Curate)
on Jan 10, 2005 at 11:18 UTC ( [id://420980]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Performing queries with DBI and DBD::MySQL

In addition to what the others said about using "LIKE", I would like to add two things:

  • You may also use a FULLTEXT search. A bit more complex, but much more effective.
  • You are fetching single records and pushing each column of them into an array. You'll get a flat array of all your dataset. Are you sure this is what you want?
    For example, if your data is the following:
    Field1Field2
    aaa1bbb1
    aaa2bbb2
    aaa3bbb3

    After your loop, it will produce an array like
    @array = ( "aaa1\n", "bbb1\n", "aaa2\n", "bbb2\n", "aaa3\n", "bbb3\n" );
    Perhaps you should consider fetchall_arrayref instead. For more guidance, you may refer to DBI recipes.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://420980]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.