Re: mysql string comparison not working
| From: | timo stamm | Date: | Tue, 03 Sep 2002 22:48:13 +0000 |
| Subject: | Re: mysql string comparison not working | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-115109@lists.php.net to get a copy of this message | ||
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