function has correct values but seems unable to return them

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • lawrence

    function has correct values but seems unable to return them

    Here I have two functions, the first returning a value to the second.
    When I put print_r() on the last line of the first function, I can see
    that the correct values are in the array as expected. But when I put
    print_r() in the second function, around the array supposedly returned
    from the first function. I get nothing. What should I look for?





    function getJustOneEntry ($cbId) {

    $query = $this->secure("SELE CT * FROM mcContentBlocks WHERE
    cbId=$cbId AND cbBelongsToWhic hWebsite='$this->cbBelongsToWhi chWebsite'");
    $result = $this->db->query($query );

    $dbArray = dbResultIntoArr ay($result);

    if ($dbArray) $dbArray = processArray($d bArray, "stripslashes") ;



    // 04-05-03 - I'm introducing this new $entryArray right now
    tonight. From now on

    // 1 dimensional returns will return a 1 dimensional array, called
    $entryArray.

    // $dbArray will continue to be 2 dimensional.

    $entry = $dbArray[0];

    print_r($entry) ;
    return $entry;

    }


















    function printEditUserFo rmForAdmin2($wa rning="", $entryId=0) {

    // 06-23-03 - redoing this form tonight.

    global $users, $sql, $forms;

    $users->check("root" );



    // 06-23-03 - normally this forms submits and calls updateUserInDs( )
    to process the input, but

    // if the two passwords don't match, then updateUserInDs( ) needs to
    kick the admin back to this page,

    // with a warning and the id of the entry under discussion. Thus the
    parameters for this function.

    if ($entryId) $cbId = $entryId;

    if (!$entryId) $cbId = getGetVar("cbId ");

    $entry = $sql->getEntryFromDb ($cbId);
    echo "<hr> $entry[1] <hr>";

    extract($rwArra y=$sql->putEntryInName dArray($entry)) ;



    startPage($warn ing);

    startForm("Edit a users name, password, or permissions here:");



    $forms->text("Enter a name for this user:", "newUserNam e",
    $newUserName);

    $forms->text("Optional : What is this users email address?",
    "cbEmail", $cbEmail);

    $forms->password("Ente r a password:", "cbPassword 1", $cbPassword);

    $forms->password("Ente r the same password again:", "cbPassword 2",
    $cbPassword);

    $forms->text("What permission should this user have? The options are
    'basic', 'verified', 'associate', and 'root'. You're insane if you
    give 'root' to anyone you don't totally trust.",
    "cbUserSecurity Level", $cbUserSecurity Level);

    $forms->output("n");



    endForm("update UserInDsForAdmi n", "cbId", $cbId);

    endPage();

    }
  • CC Zona

    #2
    Re: function has correct values but seems unable to return them

    In article <da7e68e8.03072 31731.260a5838@ posting.google. com>,
    lkrubner@geocit ies.com (lawrence) wrote:
    [color=blue]
    > Here I have two functions, the first returning a value to the second.
    > When I put print_r() on the last line of the first function, I can see
    > that the correct values are in the array as expected. But when I put
    > print_r() in the second function, around the array supposedly returned
    > from the first function. I get nothing. What should I look for?[/color]

    In the code you posted, the the second functions never calls print_r nor
    does it call the first function. Did you copy the right pair of functions?

    --
    CC

    Comment

    • lawrence

      #3
      Re: function has correct values but seems unable to return them

      CC Zona <cczona@nospam. invalid> wrote in message news:<cczona-5E2532.18590623 072003@netnews. attbi.com>...[color=blue]
      > In article <da7e68e8.03072 31731.260a5838@ posting.google. com>,
      > lkrubner@geocit ies.com (lawrence) wrote:
      >[color=green]
      > > Here I have two functions, the first returning a value to the second.
      > > When I put print_r() on the last line of the first function, I can see
      > > that the correct values are in the array as expected. But when I put
      > > print_r() in the second function, around the array supposedly returned
      > > from the first function. I get nothing. What should I look for?[/color]
      >
      > In the code you posted, the the second functions never calls print_r nor
      > does it call the first function. Did you copy the right pair of functions?[/color]


      After I went home for dinner it occured to me that I was using an
      alias and the alias could be faulty. I'd ruled that possibility out in
      my head, because I was certain I'd used the alias before. But
      apparently not. Sure enough, this morning I check, and the alias
      wasn't returning anything. The corrected alias looks like this:




      function getEntryFromDb( $cbId) {
      // 07-15-03 - alias of above
      $entry = $this->getJustOneEntr y($cbId);
      return $entry;
      }

      Comment

      Working...