Re: [PHP] escaping ' when inside a

2003-11-18 Thread Curt Zirzow
* Thus wrote Marek Kilimajer ([EMAIL PROTECTED]):
 Adam Williams wrote:
 If I have the SQL statement:
 
 $sql = select subject from subwhile where subject = '*$var[0]*';
 
 Don't you want to do:
 $sql = select subject from subwhile where subject LIKE '%$var[0]%';

I think more precisely:
$sql = select subject from subwhile where subject LIKE '%{$var[0]}%';


Curt
-- 
My PHP key is worn out

  PHP List stats since 1997: 
http://zirzow.dyndns.org/html/mlists/

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



Re: [PHP] escaping ' when inside a

2003-11-18 Thread Marek Kilimajer
Curt Zirzow wrote:
Don't you want to do:
$sql = select subject from subwhile where subject LIKE '%$var[0]%';


I think more precisely:
$sql = select subject from subwhile where subject LIKE '%{$var[0]}%';
Either will work, as will
$sql = ... subject LIKE '%$var[string_index]%';
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] escaping ' when inside a

2003-11-17 Thread Adam Williams
If I have the SQL statement:

$sql = select subject from subwhile where subject = '*$var[0]*';

do I need to put a \ before each '?

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



Re: [PHP] escaping ' when inside a

2003-11-17 Thread David T-G
Adam --

...and then Adam Williams said...
% 
% If I have the SQL statement:
% 
% $sql = select subject from subwhile where subject = '*$var[0]*';
% 
% do I need to put a \ before each '?

1) You should have just tried it.

2) No.


You owe the Newbie Guide a paragraph on quoting and escaping.

HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] escaping ' when inside a

2003-11-17 Thread Marek Kilimajer
Adam Williams wrote:
If I have the SQL statement:

$sql = select subject from subwhile where subject = '*$var[0]*';
Don't you want to do:
$sql = select subject from subwhile where subject LIKE '%$var[0]%';
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] escaping ' when inside a

2003-11-17 Thread Jay Blanchard
[snip]
 If I have the SQL statement:
 
 $sql = select subject from subwhile where subject = '*$var[0]*';

Don't you want to do:
$sql = select subject from subwhile where subject LIKE '%$var[0]%';
[/snip]

Not if the variable is exactly what he is looking for.

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



Re: [PHP] escaping ' when inside a

2003-11-17 Thread Adam Williams
Yeah thats what I meant to do, my PHP is very rusty if you can't tell 
(and so is my SQL) :)

Jay Blanchard wrote:

[snip]

If I have the SQL statement:

$sql = select subject from subwhile where subject = '*$var[0]*';


Don't you want to do:
$sql = select subject from subwhile where subject LIKE '%$var[0]%';
[/snip]
Not if the variable is exactly what he is looking for.

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