You forgot the printf method

printf("Some text %s<BR>\n",$myhash['mykey']);

Jerry

-----Original Message-----
From: jimtronic [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 18, 2001 5:59 PM
To: TD - Sales International Holland B.V.
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Arrays/Hashes



I've noticed this, too. There are at least two things you can do to 
make them work...

print("Some text {$myhash['mykey']}<BR>\n")

or

print("Some text ".$myhash['mykey']."<BR>\n")

jim

>Hey there,
>
>sortta simple question... Is it just me or can't you access hashes within
>strings?
>This works...
>print("Some text $myarray[0]<BR>\n");
>This doesn't
>print("Some text $myhash['mykey']<BR>\n");
>
>i'm asking in relation to databases (not that that matters). If i fetch a
row
>from the database I can use the $array[0], [1], etc in the print statements
>if i use mysql_fetch_array (oh sorry, u people call it associative arrays
>instead of hashes, my mistake) i can't access $array['fieldname'] from
within
>a print statement but I CAN do
>$DBID = $resultarray['idfieldname'];
>and then use $DBID.....
>
>regards
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
Jim Musil
---------
Multimedia Programmer
Nettmedia
-------------
212-629-0004
[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


The information contained in this email is confidential and
may be legally privileged. It is intended solely for the 
addressee. Access to this email by anyone else is 
unauthorized. If you are not the intended recipient, any 
form of disclosure, production, distribution or any action 
taken or refrained from in reliance on it, is prohibited and 
may be unlawful. Please notify the sender immediately.

The content of the email is not legally binding unless 
confirmed by letter bearing two authorized signatures.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to