Re: Returning a Recordset from a Funtion

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

 



On 25 June 2010 15:07, David Stoltz <Dstoltz@xxxxxxx> wrote:
> Tried that -
>
> I finally got it - in the function I had to return the actual query execute, instead of the recordset.
>
> This did not work:
>
> $rs = $conn->execute($query);
> Return $rs;
>
> This DID work:
>
> Return $conn->execute($query);
>
> Thanks for the reply!
>
> -----Original Message-----
> From: Richard Quadling [mailto:rquadling@xxxxxxxxx]
> Sent: Friday, June 25, 2010 9:59 AM
> To: David Stoltz
> Cc: php-general@xxxxxxxxxxxxx
> Subject: Re:  Returning a Recordset from a Funtion
>
> On 25 June 2010 14:55, David Stoltz <Dstoltz@xxxxxxx> wrote:
>> <?php
>>
>> include('../includes/mssql.php');
>>
>> hitMSSQL("server","database","username","password","SELECT * FROM
>> TABLE1");
>>
>> echo $rs->Fields(1);
>>
>> ?>
>
> You are not catching the result of the hitMSSQL() function.
>
> Try ...
>
> <?php
>
> include('../includes/mssql.php');
>
> $rs = hitMSSQL("server","database","username","password","SELECT * FROM
> TABLE1");
>
> echo $rs->Fields(1);
>
> ?>
>
>
> --
> -----
> Richard Quadling
> "Standing on the shoulders of some very clever giants!"
> EE : http://www.experts-exchange.com/M_248814.html
> EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
> Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
> ZOPA : http://uk.zopa.com/member/RQuadling
>


Can you ...

var_dump($rs);

in the function?

I'd be very surprised that ...

return $rs;

with

$rs = your_func();

didn't work.


So much so, I'm guessing you are not showing the whole story somewhere.



Pretty much without exception,

               $rs = $conn->execute($query);

               return $rs;

is the same as ...

               return $conn->execute($query);


Richard.
-- 
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

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



[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