Row Count

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello all,

I am having a problem with trying to count the number of rows returned by my
query. I connect to the database fine, my query displays and runs fine, but
my row count is incorrect.

If I do not put in any serch criteria and my basic query ends up being
"SELECT * FROM brev_pending_summary_detail" then the value of $rowcount is
110796. If one search criteria is used the value of $rowcount becomes 11080.
If both criteria are used the value of $rowcount is 1108.  110796 is the
correct value of my total rows in the table, but the other two values are
inncorrect and appear to just be one digit shorter and rounded off.

My query is below:

<?php
 if (!$connect_id = ifx_connect("$database@$host", $user, $pass)) { // THE
ACTUAL CONNECTION
     echo "Unable to connect to Informix Database\n"; // DISPLAY IF
CONNECTION FAILS
    exit();
 }
 $query = "SELECT * FROM brev_pending_summary_detail"; // BASIC QUERY
 if (!empty($judge_code) && empty($case_age)) {
 $query.=" WHERE judge_name = '$judge_code'";
 }
 if (empty($judge_code) && !empty($case_age)) {
 $query.=" WHERE case_age_group = '$case_age'";
 }
 if (!empty($judge_code) && !empty($case_age)) {
 $query.=" WHERE judge_name = '$judge_code' AND case_age_group =
'$case_age'";
 }
 $count_query = ifx_query ($query, $connect_id);
 $rowcount = ifx_affected_rows($count_query);
 echo $rowcount;
?>

Thanks in advance,
Dan

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux