RE: [PHP] Row Count

2008-06-10 Thread Jay Blanchard
[snip]
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.
[/snip]

http://www.php.net/mysql_num_rows


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Row Count

2008-06-10 Thread bruce
jay...

he's dealing with informix.. not sure if mysql/php calls apply.


-Original Message-
From: Jay Blanchard [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 10, 2008 7:19 AM
To: Dan Shirah; php-general
Subject: RE: [PHP] Row Count


[snip]
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.
[/snip]

http://www.php.net/mysql_num_rows


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Row Count

2008-06-10 Thread Daniel Brown
On Tue, Jun 10, 2008 at 10:11 AM, Dan Shirah [EMAIL PROTECTED] wrote:

 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.

You may also want to look into getting the number from the SQL
standard SELECT COUNT(*)  query.

 My query is below:

This should be rewritten a bit, really

[snip=code]

?php
$connect_id = ifx_connect($database.@.$host, $user, $pass);
if(!$connect_id) { // THE ACTUAL CONNECTION
echo Unable to connect to Informix Database\n; // DISPLAY IF
CONNECTION FAILS
exit(1);
}

$query = SELECT * FROM brev_pending_summary_detail; // BASIC QUERY
// Uncomment this to use the alternative method:
//$query = SELECT COUNT(*) FROM brev_pending_summary_detail;

if(!empty($judge_code)  empty($case_age)) {
$query .=  WHERE
judge_name='.mysql_real_escape_string($judge_code).';
} elseif(empty($judge_code)  !empty($case_age)) {
$query .=  WHERE
case_age_group='.mysql_real_escape_string($case_age).';
} elseif(!empty($judge_code)  !empty($case_age)) {
$query .=  WHERE
judge_name='.mysql_real_escape_string($judge_code).';
$query .=  AND
case_age_group='.mysql_real_escape_string($case_age).';
}

$count_query = ifx_query($query,$connect_id);
$rowcount = ifx_affected_rows($count_query);
echo $rowcount;
// Uncomment below and comment-out the above to use the alternative method.
$result = ifx_query($query,$connect_id);
$row = ifx_fetch_row($result);
echo $row[0];
?
-- 
/Daniel P. Brown
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Row Count

2008-06-10 Thread Daniel Brown
On Tue, Jun 10, 2008 at 10:18 AM, Jay Blanchard [EMAIL PROTECTED] wrote:

 http://www.php.net/mysql_num_rows

That would be just peachy if it worked on his Informix database, Jay.  ;-P

-- 
/Daniel P. Brown
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Row Count

2008-06-10 Thread Dan Shirah
Jay,

I am querying an Informix database, not MySQL.

When I count the rows against my MSSQL database I do use the mssql_num_rows
function and it works great. I tried using the ifx_num_rows function with
the ifx_fetch_row function but could not seem to get it to work, so instead
I used the ifx_affected_rows function to return the query count.


On 6/10/08, Jay Blanchard [EMAIL PROTECTED] wrote:

 [snip]
 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.
 [/snip]

 http://www.php.net/mysql_num_rows




RE: [PHP] Row Count

2008-06-10 Thread Jay Blanchard
[snip]
On Tue, Jun 10, 2008 at 10:18 AM, Jay Blanchard [EMAIL PROTECTED]
wrote:

 http://www.php.net/mysql_num_rows

That would be just peachy if it worked on his Informix database,
Jay.  ;-P
[/snip]

OK, OK...so I read it through too quickly!

Then I would suggest a second query to count the rows. ifx_affected_rows
cannot be relied on for accurate counts in SELECT queries, it is on
accurate for INSERT, UPDATE, and DELETE statements.

ifx_num_rows may be soon to be an included function.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Row Count

2008-06-10 Thread Daniel Brown
On Tue, Jun 10, 2008 at 10:39 AM, Jay Blanchard [EMAIL PROTECTED] wrote:

 ifx_num_rows may be soon to be an included function.

Does anyone else smell PECL's?  ;-P

-- 
/Daniel P. Brown
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Row Count

2008-06-10 Thread Jim Lucas

Daniel Brown wrote:

On Tue, Jun 10, 2008 at 10:11 AM, Dan Shirah [EMAIL PROTECTED] wrote:

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.


You may also want to look into getting the number from the SQL
standard SELECT COUNT(*)  query.


My query is below:


This should be rewritten a bit, really

[snip=code]

?php
$connect_id = ifx_connect($database.@.$host, $user, $pass);
if(!$connect_id) { // THE ACTUAL CONNECTION
echo Unable to connect to Informix Database\n; // DISPLAY IF
CONNECTION FAILS
exit(1);
}

$query = SELECT * FROM brev_pending_summary_detail; // BASIC QUERY
// Uncomment this to use the alternative method:
//$query = SELECT COUNT(*) FROM brev_pending_summary_detail;

if(!empty($judge_code)  empty($case_age)) {
$query .=  WHERE
judge_name='.mysql_real_escape_string($judge_code).';
} elseif(empty($judge_code)  !empty($case_age)) {
$query .=  WHERE
case_age_group='.mysql_real_escape_string($case_age).';
} elseif(!empty($judge_code)  !empty($case_age)) {
$query .=  WHERE
judge_name='.mysql_real_escape_string($judge_code).';
$query .=  AND
case_age_group='.mysql_real_escape_string($case_age).';
}

$count_query = ifx_query($query,$connect_id);
$rowcount = ifx_affected_rows($count_query);
echo $rowcount;
// Uncomment below and comment-out the above to use the alternative method.
$result = ifx_query($query,$connect_id);
$row = ifx_fetch_row($result);
echo $row[0];
?


Daniel Brown, did you read through this too quickly also???

You and Jay both need to slow down a bit...

--
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Twelfth Night, Act II, Scene V
by William Shakespeare


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Row Count

2008-06-10 Thread Daniel Brown
On Tue, Jun 10, 2008 at 10:54 AM, Jim Lucas [EMAIL PROTECTED] wrote:

 Daniel Brown, did you read through this too quickly also???

Jim Lucas, what did I miss?

-- 
/Daniel P. Brown
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Row Count

2008-06-10 Thread Jim Lucas

Dan Shirah wrote:

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([EMAIL PROTECTED], $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



I would suggest a re-write.  Something along the lines of this:

?php
// THE ACTUAL CONNECTION
if (!$connect_id = ifx_connect([EMAIL PROTECTED], $user, $pass)) {
  // DISPLAY IF CONNECTION FAILS
  echo Unable to connect to Informix Database\n;
  echo ifx_ errormsg();
  exit();
}

// Escape Input since the ifx extension doesn't have a tool for it
$judge_code = htmlspecialchars(addslashes($judge_code));
$case_age = htmlspecialchars(addslashes($case_age));

$count = 'SELECT COUNT(*) FROM brev_pending_summary_detail '; // BASIC QUERY

$where = array();
if ( !empty($judge_code) ) {
  $where[] = judge_name = '{$judge_code}';
}
if ( !empty($case_age) ) {
  $where[] = case_age_group = '{$case_age}';
}
if (count($where)  0) {
  $query .= ' WHERE '. join(' AND ', $where);
  $count .= ' WHERE '. join(' AND ', $where);
}
$result_id = ifx_query($query, $connect_id);
list($rowcount) = ifx_fetch_row($result_id);
echo $rowcount;
?

I think this will do what you are wanting to do.

Hopefully they add a function like mysql_real_escape_string() that will 
escape/filter you input.  But until then, you will need to sanitize it yourself.


--
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Twelfth Night, Act II, Scene V
by William Shakespeare


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Row Count

2008-06-10 Thread Jim Lucas

Daniel Brown wrote:

On Tue, Jun 10, 2008 at 10:54 AM, Jim Lucas [EMAIL PROTECTED] wrote:

Daniel Brown, did you read through this too quickly also???


Jim Lucas, what did I miss?



He is using the ifx extension for an informix database, not mysql

--
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Twelfth Night, Act II, Scene V
by William Shakespeare


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Row Count

2008-06-10 Thread Daniel Brown
On Tue, Jun 10, 2008 at 11:08 AM, Jim Lucas [EMAIL PROTECTED] wrote:
 Daniel Brown wrote:

 On Tue, Jun 10, 2008 at 10:54 AM, Jim Lucas [EMAIL PROTECTED] wrote:

 Daniel Brown, did you read through this too quickly also???

Jim Lucas, what did I miss?


 He is using the ifx extension for an informix database, not mysql

Bah.  I knew that, but force of habit typed in
mysql_real_escape_string() on the rewrite.

Curse you, routine exercises!  Curse you

-- 
/Daniel P. Brown
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Row Count

2008-06-10 Thread Jay Blanchard
[snip]
He is using the ifx extension for an informix database, not mysql
[/snip]

Dan was one of the ones who so clearly corrected me! Wow, are we all
rushing through stuff today?? 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Row Count

2008-06-10 Thread Daniel Brown
On Tue, Jun 10, 2008 at 11:27 AM, Jay Blanchard [EMAIL PROTECTED] wrote:
 [snip]
 He is using the ifx extension for an informix database, not mysql
 [/snip]

 Dan was one of the ones who so clearly corrected me! Wow, are we all
 rushing through stuff today??

I know.  I should be ashamed.

I'm going to hand you three softballs and go sit on the bench
above the water.  Do what you will.

. o 0 { And why do I think the balls would hit me in the face instead
of hitting the dunk tank target?  ;-P }

-- 
/Daniel P. Brown
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Row Count

2008-06-10 Thread bruce
jay...

nah... jus that we saw the msg at the same time!!! a freak occurance.



-Original Message-
From: Daniel Brown [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 10, 2008 8:30 AM
To: Jay Blanchard
Cc: Jim Lucas; Dan Shirah; php-general
Subject: Re: [PHP] Row Count


On Tue, Jun 10, 2008 at 11:27 AM, Jay Blanchard [EMAIL PROTECTED]
wrote:
 [snip]
 He is using the ifx extension for an informix database, not mysql
 [/snip]

 Dan was one of the ones who so clearly corrected me! Wow, are we all
 rushing through stuff today??

I know.  I should be ashamed.

I'm going to hand you three softballs and go sit on the bench
above the water.  Do what you will.

. o 0 { And why do I think the balls would hit me in the face instead
of hitting the dunk tank target?  ;-P }

--
/Daniel P. Brown
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Row Count

2008-06-10 Thread Jim Lucas

Jim Lucas wrote:

Dan Shirah wrote:

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([EMAIL PROTECTED], $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



I would suggest a re-write.  Something along the lines of this:

?php
// THE ACTUAL CONNECTION
if (!$connect_id = ifx_connect([EMAIL PROTECTED], $user, $pass)) {
  // DISPLAY IF CONNECTION FAILS
  echo Unable to connect to Informix Database\n;
  echo ifx_ errormsg();
  exit();
}

// Escape Input since the ifx extension doesn't have a tool for it
$judge_code = htmlspecialchars(addslashes($judge_code));
$case_age = htmlspecialchars(addslashes($case_age));

$count = 'SELECT COUNT(*) FROM brev_pending_summary_detail '; // BASIC 
QUERY


$where = array();
if ( !empty($judge_code) ) {
  $where[] = judge_name = '{$judge_code}';
}
if ( !empty($case_age) ) {
  $where[] = case_age_group = '{$case_age}';
}
if (count($where)  0) {
  $query .= ' WHERE '. join(' AND ', $where);
  $count .= ' WHERE '. join(' AND ', $where);
}
$result_id = ifx_query($query, $connect_id);
list($rowcount) = ifx_fetch_row($result_id);
echo $rowcount;
?

I think this will do what you are wanting to do.

Hopefully they add a function like mysql_real_escape_string() that will 
escape/filter you input.  But until then, you will need to sanitize it 
yourself.




I should slow down also and make sure all is well with my messages before 
sending.

?php
// THE ACTUAL CONNECTION
if (!$connect_id = ifx_connect([EMAIL PROTECTED], $user, $pass)) {
  // DISPLAY IF CONNECTION FAILS
  echo Unable to connect to Informix Database\n;
  echo ifx_ errormsg();
  exit();
}

// Escape Input since the ifx extension doesn't have a tool for it
$judge_code = htmlspecialchars(addslashes($judge_code));
$case_age = htmlspecialchars(addslashes($case_age));

$query = 'SELECT COUNT(*) FROM brev_pending_summary_detail '; // BASIC QUERY

$where = array();
if ( !empty($judge_code) ) {
  $where[] = judge_name = '{$judge_code}';
}
if ( !empty($case_age) ) {
  $where[] = case_age_group = '{$case_age}';
}
if (count($where)  0) {
  $query .= ' WHERE '. join(' AND ', $where);
}
$result_id = ifx_query($query, $connect_id);
list($rowcount) = ifx_fetch_row($result_id);
echo $rowcount;
?

--
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Twelfth Night, Act II, Scene V
by William Shakespeare


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Row Count

2008-06-10 Thread Daniel Brown
On Tue, Jun 10, 2008 at 12:42 PM, Jim Lucas [EMAIL PROTECTED] wrote:
 Jim Lucas wrote:

 I should slow down also and make sure all is well with my messages before
 sending.

 $query = 'SELECT COUNT(*) FROM brev_pending_summary_detail '; // BASIC QUERY

Yeah that and quit stealing the code I submitted earlier.  ;-P

-- 
/Daniel P. Brown
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Row Count

2008-06-10 Thread Daniel Brown
Quit top-posting, Shirah.  You know better than that.  ;-P

On Tue, Jun 10, 2008 at 1:49 PM, Dan Shirah [EMAIL PROTECTED] wrote:
 print_r($rowcount); returns Array ( [(count(*))] = 110796.0 ) and 110796 is
 the correct number of rows in my table, but that number isn't coming through
 the the variable.

Then, despite the fact that it's not working as $rowcount[0], it
should work as $rowcount['(count(*))'].

-- 
/Daniel P. Brown
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Row Count

2008-06-10 Thread Dan Shirah
Sorry about the top posting.  slaps hand

You my friend are a genious!  $rows = $rowcount['(count(*))'] works like a
charm!

Thank you all.


Re: [PHP] Row Count

2008-06-10 Thread Dan Shirah
Okay, I decided to try the COUNT method since all I really wanted to get in
the first place was how many rows would be returned for a specific query.

So, I have the below:

?php
 if (!$connect_id = ifx_connect([EMAIL PROTECTED], $user, $pass)) { // THE
ACTUAL CONNECTION
 echo Unable to connect to Informix Database\n; // DISPLAY IF
CONNECTION FAILS
exit();
 }
 $query = SELECT COUNT(*) FROM brev_pending_summary_detail;
 $count_query = ifx_query ($query, $connect_id);
 $rowcount = ifx_fetch_row($count_query);
 $rows = $rowcount[0];
 echo $rows;
?

I'm not getting any errors, but no number/data displays for $rows when it
should be telling me there is over 100,000 records.

Any ideas why it isn't returning a number value for $rowcount[0]/$rows?


On 6/10/08, Daniel Brown [EMAIL PROTECTED] wrote:

 On Tue, Jun 10, 2008 at 12:42 PM, Jim Lucas [EMAIL PROTECTED] wrote:
  Jim Lucas wrote:
 
  I should slow down also and make sure all is well with my messages before
  sending.
 
  $query = 'SELECT COUNT(*) FROM brev_pending_summary_detail '; // BASIC
 QUERY

Yeah that and quit stealing the code I submitted earlier.  ;-P

 --
 /Daniel P. Brown
 Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
 $59.99/mo. with no contract!
 Dedicated servers, VPS, and hosting from $2.50/mo.



Re: [PHP] Row Count

2008-06-10 Thread Daniel Brown
On Tue, Jun 10, 2008 at 1:43 PM, Dan Shirah [EMAIL PROTECTED] wrote:

 I'm not getting any errors, but no number/data displays for $rows when it
 should be telling me there is over 100,000 records.

 Any ideas why it isn't returning a number value for $rowcount[0]/$rows?

Try to print_r($rowcount);

-- 
/Daniel P. Brown
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Row Count

2008-06-10 Thread Dan Shirah
print_r($rowcount); returns Array ( [(count(*))] = 110796.0 ) and 110796 is
the correct number of rows in my table, but that number isn't coming through
the the variable.


On 6/10/08, Daniel Brown [EMAIL PROTECTED] wrote:

 On Tue, Jun 10, 2008 at 1:43 PM, Dan Shirah [EMAIL PROTECTED] wrote:
 
  I'm not getting any errors, but no number/data displays for $rows when it
  should be telling me there is over 100,000 records.
 
  Any ideas why it isn't returning a number value for $rowcount[0]/$rows?

Try to print_r($rowcount);

 --
 /Daniel P. Brown
 Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
 $59.99/mo. with no contract!
 Dedicated servers, VPS, and hosting from $2.50/mo.



RE: [PHP] Row Count

2008-06-10 Thread Jay Blanchard
[snip]
print_r($rowcount); returns Array ( [(count(*))] = 110796.0 ) and
110796 is
the correct number of rows in my table, but that number isn't coming
through
the the variable.
[/snip]

Because ifx_fetch_row returns an array, not a value.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Row Count

2008-06-10 Thread Jim Lucas

Dan Shirah wrote:

Sorry about the top posting.  slaps hand

You my friend are a genious!  $rows = $rowcount['(count(*))'] works like a
charm!

Thank you all.



So in your query, add this

SELECT COUNT(*) as total FROM your_table

Then in your code use this instead

$rows = $rowcount['total'];

This makes a little more sense then using the count(*) thing, to me at least

--
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Twelfth Night, Act II, Scene V
by William Shakespeare


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Row Count

2008-06-10 Thread Daniel Brown
On Tue, Jun 10, 2008 at 3:51 PM, Jim Lucas [EMAIL PROTECTED] wrote:

 So in your query, add this

 SELECT COUNT(*) as total FROM your_table

 Then in your code use this instead

 $rows = $rowcount['total'];

 This makes a little more sense then using the count(*) thing, to me at least

Good call.  I should've added the 'as name' portion to my query to
begin with.  Jim's way is much nicer.

-- 
/Daniel P. Brown
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php