Thread: a question!

    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2001
    Location
    http://www.crudpot.net
    Posts
    3
    Rep Power
    0

    Exclamation a question!


    I'm sad to see how much less popular this forum is compared to the MySQL one. Oh well. Anyway I just have a question about doing searches in the database. I'm sure it's really simple, but postgresql.org's documentation is really horrible (in my opinion). Anyway I just want to know how to make a simple search with php/sql. Just so people can enter a word or string and sql will select rows containing that text in a specified field.

    Check out my PHP/PostgreSQL driven website at: http://www.crudpot.net Thanks

    ~Chief
  2. #2
  3. Big Endian
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    May 2001
    Location
    Fly-over country
    Posts
    1,172
    Rep Power
    30
    Take a look at the following link and see if there is some code you can use:

    http://www.hotscripts.com/PHP/Script...earch_Engines/
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2001
    Location
    http://www.crudpot.net
    Posts
    3
    Rep Power
    0

    Smile Thanks


    I actually figured out how to do it, but thanks for that link.
    If anyone cares its just:

    select * from TABLE where COLUMN like '%searchword';

    The problem now is how to get it so it isn't case sensitive
  6. #4
  7. Big Endian
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    May 2001
    Location
    Fly-over country
    Posts
    1,172
    Rep Power
    30
    Why don't you try casting the field and search phrase to the same case? I don't have Postgresql loaded on this machine so I can't test this:

    select * from TABLE where upper(COLUMN) like upper('%searchword%');
  8. #5
  9. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2001
    Location
    Fresno, CA, USA
    Posts
    17
    Rep Power
    0
    THANK YOU

    I have been trying to figure this out!
    I have a news script for my site that I wrote, and I have a searchable news achive, but it was case sensitive.
    I had not the knoledge nor the experiance to figure this out myself.
    I even posted a message here on devshed called "Case sensitive is bad..." but to no avail
    then i searched for the words "case sensitive" and after looking at a few worthless posts, i found this

    im not sure wether it works with Postgresql or not, but it sure works with MySql
  10. #6
  11. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2001
    Location
    http://www.crudpot.net
    Posts
    3
    Rep Power
    0

    yeah it works


    it does work with Postgres as well

    thanks dcaillouet


    http://www.crudpot.net

IMN logo majestic logo threadwatch logo seochat tools logo