0

I've ran the select in sql studio manager and i know there is data associated with this account.

$test = sql::query("select ARMCODE, HOLDCODE from ARE.AAS.ME where ARMCODE = 'ADSMANZS01'");

      echo $test;

Windows Server 2008 R2

Can Anyone explain to me why I might be getting this error? I tried to print_r it as well and i get the same Resource id #39 returned. Thanks in advance.

Head Way
  • 323
  • 2
  • 4
  • 16

1 Answers1

0

It is true and it is not an error. When you ran the query you just got a handle to be used. The rows need to be fetch before you can work with. I am assuming you are using PDO to run the query. So, write a code like this to access the query rows:

$stmt = "select ARMCODE, HOLDCODE from ARE.AAS.ME where ARMCODE = 'ADSMANZS01'";
foreach ($sql::query($stmt) as $row) {
        print_r( $row) . "\n";
    }
Jose Areas
  • 719
  • 3
  • 11