On Jan 4, 2008 12:52 PM, afan pasalic <[EMAIL PROTECTED]> wrote:
> I think you didn't understand my question: I know why the function work
> in 2nd example. My question was why I'm not getting the result in 1st
> example? What am I doing wrong. And, as far as I know, I think it
> doesn't have anything with GLOBALS (register_globals are anyway turned off).
>

    You're right, I read it too quickly.  My apologies.

    Off the top of my head, they look syntactically similar, and the
end result should be the same.  Try adding some error displaying to
the script to see if anything jumps out at you.

<?

error_reporting("E_ALL");
// Include your database connection routines here.

function get_content($client_id, $form_id, $index1)
{
       $query = mysql_query("
                       SELECT content
                       FROM infos
                       WHERE client_id=".$client_id." AND
form_id=".$form_id." AND
index1='".$index1."'") or die(mysql_error());
       if (mysql_num_rows($query) > 0)
       {
               $result = mysql_fetch_assoc($query);
               return $result['content'];
       }
       else
       {
               get_content(0, 0, $index1); // get default value
       }
}

    echo get_content(12, 104, 'merchant');
?>

-- 
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

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

Reply via email to