From: | "Adam Lang" <aalang(at)rutgersinsurance(dot)com> |
---|---|
To: | <pgsql-php(at)postgresql(dot)org> |
Subject: | Re: Wildcard queries via PHP4 |
Date: | 2001-04-06 13:24:23 |
Message-ID: | 003601c0be9c$e55e1de0$330a0a0a@rutgersinsurance.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-php |
Use LIKE, as others have mentioned. The reason the wildcard doesn't work is
because it isn't supposed to. No SQL should use it.
Adam Lang
Systems Engineer
Rutgers Casualty Insurance Company
http://www.rutgersinsurance.com
----- Original Message -----
From: "rickf" <rickf(at)dufferinresearch(dot)com>
To: <pgsql-php(at)postgresql(dot)org>
Sent: Thursday, April 05, 2001 8:17 PM
Subject: [PHP] Wildcard queries via PHP4
> Hi,
>
> I am trying to find the syntax to pass a wildcard query through to
postgres.
> Basically I just want to use the user input as a substring of the actual
> query to postgres.
> It can even be simpler, I realy only need the wildcard at end of the input
> string
>
> i.e. user inputs Smith in form, I want to pick up Smith & Smithsonian.
>
> Right now I have:
>
> if ( strlen($NAME) >0):
> $NAME = addslashes($NAME);
> $NAME = strtolower($NAME); /
> $NAME = ucfirst($NAME); //translation final to Upper 1st letter
> rest lower as per db format.
>
> $conn = pg_Connect("dbname=damn_db port=5432");
> if(!$conn) { echo "Error in connecting to DB\n"; exit; }
> $result = pg_Exec($conn, "SELECT * FROM table2 WHERE surname =
> '$NAME' ");
> For whatever reason the *~ matching does not work in PHP4 (ie surname *~ )
> (or more precisely I can't get it to work)
>
> Any suggestions?
>
> Many thanks.
>
>
>
>
>
> _______________________________
> Rick Frank
> Dufferin Research
>
> mailto:rickf(at)dufferinresearch(dot)com
> ________________________________
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | rickf | 2001-04-06 14:15:45 | Sorting after a search |
Previous Message | Jesus Aneiros | 2001-04-06 02:28:08 | Re: Wildcard queries via PHP4 |