Re: function returns no value

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

 



Can't really know without the rest of the code.
Check if the function really returns and not Dying (Add some messege like: die("help me I'm dying"); ).
Also use print_r or something like to see what's inside the fields array.
it is possible that it's an associative array and you are using the wrong index (0)

Liran
----- Original Message ----- From: "Ali Reza Sajedi" <arsajedi@xxxxxxxxxxxxx>
To: <php-general@xxxxxxxxxxxxx>
Sent: Sunday, April 20, 2008 11:51 PM
Subject:  function returns no value


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];
}

Could anybody see what is going wrong here?

I appreciate any hint.

Ali

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


[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