RE: [PHP] Arrays/Hashes

From: Date: Wed, 19 Dec 2001 08:31:53 +0000
Subject: RE: [PHP] Arrays/Hashes
Groups: php.general 
Request: Send a blank email to php-general+get-78188@lists.php.net to get a copy of this message
You forgot the printf method printf("Some text %s<BR>\n",$myhash['mykey']); Jerry -----Original Message----- From: jimtronic [mailto:jim@nettmedia.com] Sent: Tuesday, December 18, 2001 5:59 PM To: TD - Sales International Holland B.V. Cc: php-general@lists.php.net 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: php-general-unsubscribe@lists.php.net >For additional commands, e-mail: php-general-help@lists.php.net >To contact the list administrators, e-mail: php-list-admin@lists.php.net -- Jim Musil --------- Multimedia Programmer Nettmedia ------------- 212-629-0004 jim@nettmedia.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net 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.

« previous php.general (#78188) next »