SuprSpy79
asked on
PHP: Count Rows in COM object array?
I'm using php to work with a foxpro database.
using this select
$pricelist = "select * from PRODATA!ICITEM01 WHERE market1>0 ORDER BY itmdesc";
I need to count the number or rows (or better yet, actually see if it retrieved any data at all).
I know this can be done in my sql with mySQL_num_rows but working with com objects seems to be different so i dont think that would work.
Thansk in advance
using this select
$pricelist = "select * from PRODATA!ICITEM01 WHERE market1>0 ORDER BY itmdesc";
I need to count the number or rows (or better yet, actually see if it retrieved any data at all).
I know this can be done in my sql with mySQL_num_rows but working with com objects seems to be different so i dont think that would work.
Thansk in advance
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
You can print it as you output the other things you read from the database.
ASKER
how do i do that?
normally i have to
$rs = $conn->Execute($pricelist) ;
$cntpatest = $rs->Fields("cntpa");
echo $cntpatest->value;
but this isnt returning any fields with values its returning a single number. Its returning as a vartiant so I cant echo $rs
normally i have to
$rs = $conn->Execute($pricelist)
$cntpatest = $rs->Fields("cntpa");
echo $cntpatest->value;
but this isnt returning any fields with values its returning a single number. Its returning as a vartiant so I cant echo $rs
Should be printed with
$pricelist = "select count(*) as num from PRODATA!ICITEM01 WHERE market1>0 ORDER BY itmdesc";
$rs = $conn->Execute($pricelist) ;
$cntpatest = $rs->Fields("num");
echo $cntpatest->value;
$pricelist = "select count(*) as num from PRODATA!ICITEM01 WHERE market1>0 ORDER BY itmdesc";
$rs = $conn->Execute($pricelist)
$cntpatest = $rs->Fields("num");
echo $cntpatest->value;
ASKER
great that worked, now i just need help with making my selects so i can compare the num of rows. here is the link
https://www.experts-exchange.com/questions/23479705/Need-Help-with-a-select.html
https://www.experts-exchange.com/questions/23479705/Need-Help-with-a-select.html
ASKER