[PHP] mysql string comparison not working

2002-09-03 Thread David Banning

if I set test = Y;
then

if ($test == Y) {echo (it matches);}

seems to work while

if ($row[24] == Y) {echo (it matches);}

does not.
The row[24] mysql variable is char type and 1 char long.

any idea why it is not doing the comparison?

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




Re: [PHP] mysql string comparison not working

2002-09-03 Thread timo stamm

Hi David,


in PHP, you can not access associative arrays with index numbers 
(and your mysql row arrays will be of the associative kind).

But Chris posted a kludge recently:

//snip
Just for kicks ... here's something pretty ugly (I'd never use it), but
neat if you're interested (or somehow really have your heart set 
on using
integers).  There are probably a handful of other ways to do this:

$test = array ( 'a' = 'A', 'b' = 'B', 'c' = 'C');
$test_keys = array_keys( $test );
print $test[$test_keys[2]];  // Prints C - Same as print $test['c'];

~Chris
//snip


Timo


Am Dienstag den, 3. September 2002, um 08:33, schrieb David Banning:

 if I set test = Y;
 then

 if ($test == Y) {echo (it matches);}

 seems to work while

 if ($row[24] == Y) {echo (it matches);}

 does not.
 The row[24] mysql variable is char type and 1 char long.

 any idea why it is not doing the comparison?

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



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