ID:               49256
 Comment by:       selotsom at hotmail dot com
 Reported By:      rafinguer at gmail dot com
 Status:           Open
 Bug Type:         PostgreSQL related
 Operating System: Windows Vista
 PHP Version:      5.2SVN-2009-08-14 (snap)
 New Comment:

I use postgre and php, and I have not any problem. I also use logical
deletions with a boolean field, and it works well.

Please, send me your code and the database model at
selot...@hotmail.com


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

[2009-08-15 09:30:33] rafinguer at yahoo dot es

I'm sorry. The code is not correct. The code is the next following:

$result="";
$qry = "select id_product_type, name_product_type ".
       "from sch_trazalogic.product_type ".
       "where deleted=false ".
       "order by name_product_type";
$result_qry = pg_query($connection, $qry);
$num_rows = pg_numrows($result_qry);
$current=0;
while ($current<$num_rows) {
  $row = pg_fetch_row($result_qry, $current);  // fetch current row
  $result = $result.$row[0]."-".$row[1]."\n";
  $current++;
}
pg_close($connection);
echo $result;

Apache version is 2.2

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

[2009-08-15 09:25:55] rafinguer at yahoo dot es

I forgot to mention that the version of PostgreSQL is 8.3

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

[2009-08-14 16:07:01] rafinguer at gmail dot com

Description:
------------
PHP ignores the true or false values in a SQL sentence, returning
always  
all the records:

select id_product_type, name_product_type 
from sch_trazalogic.product_type 
where deleted=false
order by name_product_type

I tried with "where deleted='f'" and with "where not deleted". The 
result is the same. With PGAdmin (Query tool), the result is correct.

Reproduce code:
---------------
$result="";
$qry = "select id_product_type, name_product_type ".
       "from sch_trazalogic.product_type ".
       "where deleted=false ".
       "order by name_product_type";
$result_qry = pg_query($connection, $qry);
$num_rows = pg_numrows($result_qry);
$current=0;
while ($current<$num_rows) {
  $row = pg_fetch_row($result_qry, $current);  // fetch current row
  $result = $result_xml.$row[0]."-".$row[1]."\n";
  $current++;
}
pg_close($connection);
echo $result_xml;


Expected result:
----------------
All the records with "deleted" with "false" value

Actual result:
--------------
All the records (deleted=true and deleted=false)


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


-- 
Edit this bug report at http://bugs.php.net/?id=49256&edit=1

Reply via email to