ID: 34030
Updated by: [EMAIL PROTECTED]
Reported By: mansilla_g at yahoo dot com
-Status: Open
+Status: Feedback
Bug Type: PostgreSQL related
Operating System: linux
PHP Version: 4.3.11
New Comment:
Instead of that echo $row[0]; do this:
var_dump($row[0]);
Previous Comments:
------------------------------------------------------------------------
[2005-08-08 04:26:22] mansilla_g at yahoo dot com
i forgot, using "===" doenst work either
but the most interesting if that you compare numbers it works, for
example, lets suppose $Row[1] = 34030 then you compare, if ( $Row[1]
== 34030) , it returns true :S
------------------------------------------------------------------------
[2005-08-08 03:54:44] mansilla_g at yahoo dot com
Description:
------------
when you get a string from a pg_fetch_row function it cant be compared
with other string correctly, but if you use odbc_fetch_row it works,
note that i compare ($row[0] == "Guille"), even if i assign $a =
"Guille" and then i try to compare ($row[0] == $a) i get a wrong
result, but it i use odbc_fetch_row or odbc_fetch_array instead it
works.
Reproduce code:
---------------
<?php
$conn = pg_pconnect("","","","","mydb");
$query = "Select nombre from empleados where id = 1";
$resultado = pg_Exec($conn, $query);
$row = pg_fetch_row($resultado);
echo ($row[0]);
if ($row[0] == "Guille") {
echo ("$row[0] is = Guille"); }
else {
echo ("$row[0] is not Guille");
}
?>
Expected result:
----------------
Guille
Guille is = Guille
Actual result:
--------------
Guille
Guille is not Guille
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=34030&edit=1