Re: why won't my array work?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Mar 28, 2008 at 12:28 PM, Jason Pruim <japruim@xxxxxxxxxx> wrote:
>  $chpwold[] = mysqli_query($chpwpostlink, $oldpasswordquery) or
>  die("Sorry read failed: ". mysqli_error($chpwpostlink));
>  $chpwresult = $chpwold[0];

Why would you pump that into an array instead of just calling it
result itself?  I'd say you're just making it harder on yourself for
no apparent reason.

The problem seems to be on your other line.

$chpwrow[] = mysqli_fetch_assoc($chpwresult) or die('Sorry it didn\'t
work....' .mysqli_error($chpwpostlink));
echo $chpwrow['loginPassword'];

Just fetch the row into a single variable and not an array.  In your
example  you'd need to access chpwrow[0]['loginPassword'] assuming it
was an empty array up to that point.

Calling things old query and old password isn't really adding any
value to your code.  If you're only going to use it once then throw it
away call it result so it is easier to read and understand.  But then
again feel free to ignore this.  Also is there a reason why you aren't
using prepared statements?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux