473,545 Members | 1,859 Online
Bytes | Software Development & Data Engineering Community
+ 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("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();

}
Jul 16 '05 #1
2 1858
In article <da************ **************@ posting.google. com>,
lk******@geocit ies.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.at tbi.com>...
In article <da************ **************@ posting.google. com>,
lk******@geocit ies.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->getJustOneEntr y($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
1595
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 y and z return y,z except: return None,None
35
4506
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 go to great lengths to restructure my code just to look concise and make it more manageable. When I say this, I'm also referring to the way I...
6
4046
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). // Integer calculation (fast) int iround(const double x) { return (x>=0 ? static_cast<int>(x + 0.5) : static_cast<int>(x + 0.5) } // Floating...
19
3318
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 = *pchData++ - 'A'; if (cBuf <= 'Z' - 'A')
18
3109
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 how global variables and function returns work... For example, I have a global array "char datestring;" which is defined in the function speakdate....
4
2350
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 which I mean here. Just for a moment, let's just take one definition for one of the
3
3633
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' that takes arguments of type (void *) because the ADT must be able to deal with any type of data. In my actual code, I will code the function to take...
6
4299
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 have holidays we require our employees to sign up in 4 hr increments for the times we post. I'm having trouble creating a time slot that ends @ 12am....
160
5757
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
7416
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7932
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7442
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6001
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5347
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3473
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3456
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1905
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
729
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.