RE: [PHP-DB] Using functions in SELECT statements

2002-05-02 Thread matt stewart

The problem is that you can't do a php function on a field name inside a
query, only on the contents after the query has already been executed!

The LIKE function in sql is case insensitive anyway, so you'll pull out all
the matches just by using:

$sql = "SELECT * FROM Organisation_Membership WHERE organisation LIKE
'%$SearchBox'";

if this is the wrong anser, and you were trying to do something different,
let me know!

Matt Stewart

[EMAIL PROTECTED]




-Original Message-
From: Robin S McKenzie [mailto:[EMAIL PROTECTED]]
Sent: 02 May 2002 15:11
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Using functions in SELECT statements



If only it were that simple - sorry, that was a copying error...

It gives the error " undefined function: lower"

R

Robin McKenzie Department of Mechanical Engineering University of Bristol
e:[EMAIL PROTECTED] e:[EMAIL PROTECTED] m:+44(0)7970 058712

"Peter Lovatt" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
>
>
> Could it be the second $ in the lower('%$SearchBox$%') ?
>
> Peter
>
>
>
> ---
> Excellence in internet and open source software
> ---
> Sunmaia
> www.sunmaia.net
> [EMAIL PROTECTED]
> tel. 0121-242-1473
> ---
>
> > -Original Message-
> > From: Robin S McKenzie [mailto:[EMAIL PROTECTED]]
> > Sent: 02 May 2002 14:34
> > To: [EMAIL PROTECTED]
> > Subject: [PHP-DB] Using functions in SELECT statements
> >
> >
> >
> > I'm trying perform a case-insensitive test for a name.  These are stored
> > like "Association of ...", and I want to convert both the filter and the
> > test data to lower- (or upper-) case.  Why doesn't this work:   ?
> >
> > SELECT *
> > FROM [Organisation Membership]
> > WHERE lower(organisation) LIKE lower('%$SearchBox$%')
> >
> > Robin McKenzie
> > Department of Mechanical Engineering
> > University of Bristol
> > e:[EMAIL PROTECTED]
> > e:[EMAIL PROTECTED]
> > m:+44(0)7970 058712
> > 
> >
> >
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >



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

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




Re: [PHP-DB] Using functions in SELECT statements

2002-05-02 Thread Tony James

Hi Robin


Instead of using sql to change the case of the search criteria try using php
as in the statement below

$query="
SELECT *
FROM [Organisation Membership]
WHERE lower(organisation) LIKE  '%". strtolower($SearchBox) ."%')";

Hope this is of some help to you
Tony James

- Original Message -
From: "Robin S McKenzie" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, May 02, 2002 3:11 PM
Subject: Re: [PHP-DB] Using functions in SELECT statements



If only it were that simple - sorry, that was a copying error...

It gives the error " undefined function: lower"

R

Robin McKenzie Department of Mechanical Engineering University of Bristol
e:[EMAIL PROTECTED] e:[EMAIL PROTECTED] m:+44(0)7970 058712

"Peter Lovatt" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
>
>
> Could it be the second $ in the lower('%$SearchBox$%') ?
>
> Peter
>
>
>
> ---
> Excellence in internet and open source software
> ---
> Sunmaia
> www.sunmaia.net
> [EMAIL PROTECTED]
> tel. 0121-242-1473
> ---
>
> > -Original Message-
> > From: Robin S McKenzie [mailto:[EMAIL PROTECTED]]
> > Sent: 02 May 2002 14:34
> > To: [EMAIL PROTECTED]
> > Subject: [PHP-DB] Using functions in SELECT statements
> >
> >
> >
> > I'm trying perform a case-insensitive test for a name.  These are stored
> > like "Association of ...", and I want to convert both the filter and the
> > test data to lower- (or upper-) case.  Why doesn't this work:   ?
> >
> > SELECT *
> > FROM [Organisation Membership]
> > WHERE lower(organisation) LIKE lower('%$SearchBox$%')
> >
> > Robin McKenzie
> > Department of Mechanical Engineering
> > University of Bristol
> > e:[EMAIL PROTECTED]
> > e:[EMAIL PROTECTED]
> > m:+44(0)7970 058712
> > 
> >
> >
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >



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



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




Re: [PHP-DB] Using functions in SELECT statements

2002-05-02 Thread Robin S McKenzie


If only it were that simple - sorry, that was a copying error...

It gives the error " undefined function: lower"

R

Robin McKenzie Department of Mechanical Engineering University of Bristol
e:[EMAIL PROTECTED] e:[EMAIL PROTECTED] m:+44(0)7970 058712

"Peter Lovatt" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
>
>
> Could it be the second $ in the lower('%$SearchBox$%') ?
>
> Peter
>
>
>
> ---
> Excellence in internet and open source software
> ---
> Sunmaia
> www.sunmaia.net
> [EMAIL PROTECTED]
> tel. 0121-242-1473
> ---
>
> > -Original Message-
> > From: Robin S McKenzie [mailto:[EMAIL PROTECTED]]
> > Sent: 02 May 2002 14:34
> > To: [EMAIL PROTECTED]
> > Subject: [PHP-DB] Using functions in SELECT statements
> >
> >
> >
> > I'm trying perform a case-insensitive test for a name.  These are stored
> > like "Association of ...", and I want to convert both the filter and the
> > test data to lower- (or upper-) case.  Why doesn't this work:   ?
> >
> > SELECT *
> > FROM [Organisation Membership]
> > WHERE lower(organisation) LIKE lower('%$SearchBox$%')
> >
> > Robin McKenzie
> > Department of Mechanical Engineering
> > University of Bristol
> > e:[EMAIL PROTECTED]
> > e:[EMAIL PROTECTED]
> > m:+44(0)7970 058712
> > 
> >
> >
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >



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