RE: [PHP] Maybe a silly question

From: Date: Fri, 10 Oct 2003 06:00:24 +0000
Subject: RE: [PHP] Maybe a silly question
Groups: php.general 
Request: Send a blank email to php-general+get-165708@lists.php.net to get a copy of this message
It's commonly seen in OOP (Object Oriented Programming) and allows you access to an objects data by name of the entity within the structure. I find it really useful for mysql/php work. $result = mysql_query("SELECT * From Personal_Details WHERE USER_ID='12345'") ; $data = mysql_fetch_object($result) ; print "My name: " . $data->full_name . " and email are : " . $data->email_addr . "<BR>" ; And full_name and email_addr are field names in the database table... so you don't need to worry about $data[0] being the field you expect it to be should you go an change the table layout with ALTER TABLE. Cheers, Andrew > -----Original Message----- > From: Tom Ray [Lists] [mailto:lists@blazestudios.com] > Sent: Friday, 10 October 2003 3:57 PM > To: php-general@lists.php.net > > I'm wondering if someone can explain something for me. I've > never used this before but have seen it used in numerous sets > of coding. > > What does the -> do? I see stuff like > > $test=$test->test_url = "Something"; > $test1=$test->test_this = "Something Else"; > > Is it some sort of array function? I'm just a little confused > and have been wondering for sometime. > > TIA > > -- > PHP General Mailing List (http://www.php.net/) To > unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.general (#165708) next »