473,480 Members | 1,998 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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("SELECT * FROM mcContentBlocks WHERE
cbId=$cbId AND cbBelongsToWhichWebsite='$this->cbBelongsToWhichWebsite'");
$result = $this->db->query($query);

$dbArray = dbResultIntoArray($result);

if ($dbArray) $dbArray = processArray($dbArray, "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 printEditUserFormForAdmin2($warning="", $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($rwArray=$sql->putEntryInNamedArray($entry));

startPage($warning);

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

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

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

$forms->password("Enter a password:", "cbPassword1", $cbPassword);

$forms->password("Enter the same password again:", "cbPassword2",
$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.",
"cbUserSecurityLevel", $cbUserSecurityLevel);

$forms->output("n");

endForm("updateUserInDsForAdmin", "cbId", $cbId);

endPage();

}
Jul 16 '05 #1
2 1851
In article <da**************************@posting.google.com >,
lk******@geocities.com (lawrence) wrote:
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?


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
Jul 16 '05 #2
CC Zona <cc****@nospam.invalid> wrote in message news:<cc**************************@netnews.attbi.c om>...
In article <da**************************@posting.google.com >,
lk******@geocities.com (lawrence) wrote:
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?


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?

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->getJustOneEntry($cbId);
return $entry;
}
Jul 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
1584
by: beliavsky | last post by:
If a function that normally returns N values raises an exception, what should it return? N values of None seems reasonable to me, so I would write code such as def foo(x): try: # code setting...
35
4492
by: wired | last post by:
Hi, I've just taught myself C++, so I haven't learnt much about style or the like from any single source, and I'm quite styleless as a result. But at the same time, I really want nice code and I...
6
4039
by: Jef Driesen | last post by:
I need to implement a function to implement the rounding of floating point values. At the moment i have two different implementations, depending on the type of the return value (integer or double)....
19
3309
by: anguo | last post by:
i find in many hash function use 5381,for exampla: static constmap_hash hash(char *pchData, int iLen) { unsigned char cBuf; constmap_hash ulHashId; ulHashId = 5381; while (iLen > 0) { cBuf =...
18
3100
by: ben.carbery | last post by:
Hi, I have just written a simple program to get me started in C that calculates the number of days since your birthdate. One thing that confuses me about the program (even though it works) is...
4
2346
by: Michael | last post by:
Hi, I'm having difficulty finding any previous discussion on this -- I keep finding people either having problems calling os.exec(lepev), or with using python's exec statement. Neither of...
3
3621
by: Beta What | last post by:
Hello, I have a question about casting a function pointer. Say I want to make a generic module (say some ADT implementation) that requires a function pointer from the 'actual/other modules'...
6
4288
by: D | last post by:
Hello all...I have an issue with one of my java script functions that I'm hoping someone can easily help with. I have a web based application that we use to create/sign up for overtime. When we...
160
5727
by: DiAvOl | last post by:
Hello everyone, Please take a look at the following code: #include <stdio.h> typedef struct person { char name; int age; } Person;
0
6908
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7081
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6737
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
6921
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4776
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4481
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
2995
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
563
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
179
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.