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();
}
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();
}
Comment