using $result->fields["fa"]  did solve the problem.

thanks very much Thijs

----- Original Message ----- From: "Thijs Lensselink" <[EMAIL PROTECTED]>
To: <php-general@lists.php.net>
Sent: Monday, April 21, 2008 2:48 PM
Subject: Re: [PHP] function returns no value


Quoting Ali Reza Sajedi <[EMAIL PROTECTED]>:

I added var_dump($result); to the function.

As part of the output I get the following:

["fields"]=> array(1) { ["fa"]=> string(22) "ورود به سایت"}

which is the string which should be returned and printed.

The result is there, however, it couldn't be printed.

Any ideas?

Regards

Ali

----- Original Message ----- From: Nathan Nobbe
To: Ali Reza Sajedi
Cc: php-general@lists.php.net
Sent: Monday, April 21, 2008 12:42 AM
Subject: Re: [PHP] function returns no value


On Sun, Apr 20, 2008 at 4:51 PM, Ali Reza Sajedi
<[EMAIL PROTECTED]> wrote:

Hello,

with the following call I try to print a string out of DB

echo $allg->translate($db, $lang, 14, "auth/authCallback", 4);

function translate () should do a DB querry and returns the requested
string. Although the querry yields a positive result, the function
returns no value.

Here is the function:

function translate ($db, $lang, $MaiKey, $page, $pid) {

$statement = "SELECT fa FROM language WHERE MaiKey='$MaiKey' AND
page='$page' AND pid='$pid'";

$result = $db->Execute($statement);

if ($result=== false) die();

return $result->fields[0];

Try $result->fields["fa"] instead.

}

Could anybody see what is going wrong here?

its hard to say, since we cant see whats going on inside the Execute
function...  you might try to add a
var_dump($result);
directly after the call to Execute, just for debugging purposes, then
remove it once you know whats going on.

-nathan -- 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

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

Reply via email to