For Programmers: Free Programming Magazines  


Home > Archive > PHP Programming > July 2007 > Where are my values?!









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Where are my values?!
Sanders Kaufman

2007-07-25, 7:00 pm

No - this isn't a morality question. :)

When I run this:
foreach ($this->RecordSet[0] as $x=>$y){
echo "<br>$x = $y";
}

I get this:
username = alpha
password = omega

But when I run this:
echo $this->Recordset[0]["username"]
echo $this->Recordset[0]["password"]

I don't get squat.


I know it's something symple with the sintax - but I just ain't seeing it.

What am I doing wrong?!
Michael Fesser

2007-07-25, 7:00 pm

..oO(Sanders Kaufman)

>No - this isn't a morality question. :)


There's not even a constructor ... SCNR ;)

>When I run this:
> foreach ($this->RecordSet[0] as $x=>$y){
> echo "<br>$x = $y";
> }
>
>I get this:
> username = alpha
> password = omega
>
>But when I run this:
> echo $this->Recordset[0]["username"]
> echo $this->Recordset[0]["password"]
>
>I don't get squat.
>
>
>I know it's something symple with the sintax - but I just ain't seeing it.


Do you have error_reporting set to E_ALL? PHP should give you a notice.

$this->RecordSet
$this->Recordset

See the difference?

Micha
Chris Hope

2007-07-25, 7:00 pm

Sanders Kaufman wrote:

> No - this isn't a morality question. :)
>
> When I run this:
> foreach ($this->RecordSet[0] as $x=>$y){
> echo "<br>$x = $y";
> }
>
> I get this:
> username = alpha
> password = omega
>
> But when I run this:
> echo $this->Recordset[0]["username"]
> echo $this->Recordset[0]["password"]
>
> I don't get squat.
>
>
> I know it's something symple with the sintax - but I just ain't seeing
> it.
>
> What am I doing wrong?!


Case sensitivity.

$this->RecordSet[0]

is not the same as

$this->Recordset[0]

--
Chris Hope | www.electrictoolbox.com | www.linuxcdmall.com
Sanders Kaufman

2007-07-25, 7:00 pm

Michael Fesser wrote:
> .oO(Sanders Kaufman)
>
>
> There's not even a constructor ... SCNR ;)
>
>
> Do you have error_reporting set to E_ALL? PHP should give you a notice.
>
> $this->RecordSet
> $this->Recordset
>
> See the difference?


Oh, for crying out loud!
I knew it was something stupid.
Thanks.
Toby A Inkster

2007-07-25, 7:00 pm

Sanders Kaufman wrote:

> But when I run this:
> echo $this->Recordset[0]["username"]
> echo $this->Recordset[0]["password"]
>
> I don't get squat.


Are you sure the keys are exactly right? Sure it's not something like...

$this->Recordset[0]["username "]

??

--
Toby A Inkster BSc (Hons) ARCS
[G of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.12-12mdksmp, up 35 days, 1:40.]

Cryptography Challenge
http://tobyinkster.co.uk/blog/2007/...ypto-challenge/
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com