RES: [PHP] why won't my array work?



That's because your loginpassWord is in another array.

try $chpwrow[0]['loginPassword']

-----Mensagem original-----
De: Jason Pruim [mailto:japruim@xxxxxxxxxx]
Enviada em: sexta-feira, 28 de março de 2008 13:29
Para: [php] PHP General List
Assunto: [PHP] why won't my array work?

Hi everyone :) Happy friday to all of you!

Here's my issues, I am attempting to echo the results of mysqli
query out to my script just so I can make sure it's working
right, what I'm hoping to do in the long run is compare what
was typed in a text box to this info... It's for verifying a
old password before changing to a new password... So here is my query:

$oldpasswordquery = "SELECT loginPassword, Record FROM current
WHERE loginPassword='{$oldPassHash}' AND Record='{$Record}'";
$chpwold[] = mysqli_query($chpwpostlink, $oldpasswordquery) or
die("Sorry read failed: ". mysqli_error($chpwpostlink));
$chpwresult = $chpwold[0]; $chpwrow[] =
mysqli_fetch_assoc($chpwresult) or die('Sorry it didn\'t
work....' .mysqli_error($chpwpostlink)); echo
$chpwrow['loginPassword']; print_r($chpwrow);


The echo and the print_r are for debugging and obviously wont'
be in the final script... Here is the error that I am getting:

[Fri Mar 28 12:14:39 2008] [error] PHP Notice: Undefined index:
loginPassword in /Volumes/RAIDer/webserver/Documents/dev/OLDBv2/admin/
chpwpost.php on line 18


Line 18 is where the echo is...

the print_r though shows this:

Array ( [0] => Array ( [loginPassword] =>
42205baa2581d3fcd8d8f9c6b9746a1f [Record] => 2 ) )

So why can't I access it via $chpwrow['loginPassword']? I'm
stumped.... Anyone that can help me has a free beer waiting for them
the next time they are in my town! :)


--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
www.raoset.com
japruim@xxxxxxxxxx




.



Relevant Pages

  • NOCC Webmail <= 1.0 multiple vulnerabilities
    ... "NOCC is a webmail client written in PHP. ... remote code execution, there are two ways of execute arbitrary code on ... is defined in conf.php, by default no path is defined, but script suggests ... echo nl2br); ...
    (Bugtraq)
  • Re: [PHP] Help with an error...
    ... I am currently working on a php script that will be called by cron. ... echo 'This could not be display due to a system error. ...
    (php.general)
  • Re: [PHP] Help with an error...
    ... I am currently working on a php script that will be called by cron. ... echo 'This could not be display due to a system error. ...
    (php.general)
  • Re: [PHP] Help with an error...
    ... Also, if you want HTML tags in your PHP code, you need to end and start ... I am currently working on a php script that will be called by cron. ... echo 'This could not be display due to a system ...
    (php.general)
  • Re: [PHP] Help with an error...
    ... I am currently working on a php script that will be called by cron. ... echo 'This could not be display due to a system error. ...
    (php.general)