Re: [PHP] Re: Simple Search Logic Issue...

2009-02-17 Thread David Robley
Bastien Koert wrote:

> [snip]
>>
>>
>>
>> For example LIKE 'c' will only match a field that contains just 'c'
>>
>> LIKE '%c' will match a field starting with 'c' and containing any number
>> of characters
>>
>> [/snip]
>> Cheers
>> --
>> David Robley
>>
>> Make like a banana and split.
>> Today is Sweetmorn, the 46th day of Chaos in the YOLD 3175.
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
> hate to do this at a late date, but %c will match anything ending in
> 'c'...'c%' will match anything starting in 'c'
> 
Um, of course that is exactly what I told my fingers to type, but somehow
they didn't listen to me :-)



Cheers
-- 
David Robley

... "I will not raise taxes on the middle class." -- Bill
Today is Pungenday, the 48th day of Chaos in the YOLD 3175. 


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



Re: [PHP] Re: Simple Search Logic Issue...

2009-02-16 Thread Bastien Koert
[snip]
>
>
>
> For example LIKE 'c' will only match a field that contains just 'c'
>
> LIKE '%c' will match a field starting with 'c' and containing any number of
> characters
>
> [/snip]
> Cheers
> --
> David Robley
>
> Make like a banana and split.
> Today is Sweetmorn, the 46th day of Chaos in the YOLD 3175.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
hate to do this at a late date, but %c will match anything ending in
'c'...'c%' will match anything starting in 'c'

-- 

Bastien

Cat, the other other white meat


Re: [PHP] Re: Simple Search Logic Issue...

2009-02-15 Thread revDAVE
On 2/15/2009 3:32 AM, "David Robley"  wrote:

> If you are using that syntax, I'd suggest echoing your query to make sure
> that it is as it should be; I'm wondering if you are actually enclosing
> string values in single quotes in your query?


Another part of the dw cs3 code uses switch - that seems to do as you
mentioned...

if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "",
$theNotDefinedValue = "")
{
  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  $theValue = function_exists("mysql_real_escape_string") ?
mysql_real_escape_string($theValue) : mysql_escape_string($theValue);


Here

  switch ($theType) {
case "text":
  $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  break;
etc.



--
Thanks - RevDave
Cool @ hosting4days . com
[db-lists 09]




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



Re: [PHP] Re: Simple Search Logic Issue...

2009-02-15 Thread revDAVE
On 2/15/2009 3:32 AM, "David Robley"  wrote:

> 
> LIKE '%c%' will match a field containing 'c' anywhere
> 
> If you are using that syntax, I'd suggest echoing your query to make sure
> that it is as it should be; I'm wondering if you are actually enclosing
> string values in single quotes in your query?

Thanks David for your help

The input form is basic like:



Then dreamweaver cs3 created this

$mess_list1 = "-1";
if (isset($_GET['Message'])) {
  $mess_list1 = $_GET['Message'];
}

... But it doesn't look like it does what you say : actually enclosing
string values in quotes

Maybe ?: 


$mess_list1 = '$_GET['Message']';
Not 
$mess_list1 = $_GET['Message'];
???

> 
> As for multiple selection criteria, you need to test whether the passed in
> value is set or not, and only include set values in the query.

Not sure - but isn't that what this code is doing ...???


$mess_list1 = "-1";
if (isset($_GET['Message'])) {
  $mess_list1 = $_GET['Message'];
}

> 
> OT: sprintf syntax is so hard to read :-)

I agree - especially for this newbie...

--
Thanks - RevDave
Cool @ hosting4days . com
[db-lists 09]




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