note 77178 added to function.mysql-fetch-object

From: Date: Sat, 18 Aug 2007 17:03:39 +0000
Subject: note 77178 added to function.mysql-fetch-object
Groups: php.notes 
Request: Send a blank email to php-notes+get-129576@lists.php.net to get a copy of this message
In reply to rodolphe dot bodeau at free dot fr : The function mysql_fetch_object has other two parameters that you can use. As the manual say: mysql_fetch_object( $resource, $class_name, $params ) ) $class_name and $params are optional. So if you want to fetch a row in a class you can: 1) Define your class Test with method and other stuff. 2) Execute Query 3) call: $Object = mysql_fetch_object( $Resource, "Test" ); so you can use $Object with the methods Be aware how you write code in your methods: in this case, classes are used for centralize the code and they are not really safe because you can have an additional Information ( with a Join Query for example ) without methods to access to them. So classes need get and set method generalized. ( for extra see PHP 5 Manual O'Rielly on the use of generalized methods get and set ) ---- Server IP: 69.147.83.197 Probable Submitter: 87.13.210.156 ---- Manual Page -- http://www.php.net/manual/en/function.mysql-fetch-object.php Edit -- https://master.php.net/note/edit/77178 Del: integrated -- https://master.php.net/note/delete/77178/integrated Del: useless -- https://master.php.net/note/delete/77178/useless Del: bad code -- https://master.php.net/note/delete/77178/bad+code Del: spam -- https://master.php.net/note/delete/77178/spam Del: non-english -- https://master.php.net/note/delete/77178/non-english Del: in docs -- https://master.php.net/note/delete/77178/in+docs Del: other reasons-- https://master.php.net/note/delete/77178 Reject -- https://master.php.net/note/reject/77178 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#129576) next »