ID:               34030
 User updated by:  mansilla_g at yahoo dot com
 Reported By:      mansilla_g at yahoo dot com
-Status:           Feedback
+Status:           Open
 Bug Type:         PostgreSQL related
 Operating System: linux
 PHP Version:      4.3.11
 New Comment:

the result is the same, the trouble is not to print the output, the
trouble is that when you retrieve a string this can not be compared,
"var_dumping" tells me string(50) "Guille ", so the result is "Guille "
i mean $row[0] = "Guille", and the strange is that ( $row[0] == "Guille
") returns false :S


Previous Comments:
------------------------------------------------------------------------

[2005-08-08 08:57:30] [EMAIL PROTECTED]

Instead of that echo $row[0]; do this:

var_dump($row[0]);


------------------------------------------------------------------------

[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

Reply via email to