class method

From: Date: Tue, 20 Mar 2001 19:21:50 +0000
Subject: class method
Groups: php.db 
Request: Send a blank email to php-db+get-7658@lists.php.net to get a copy of this message
I am really new working with classes. Some of the ideas I am getting, some I am not. I wrote this simple little class, with a connection method, and a method to loop through the data. I am not even sure if my code is write (for the loop), but I am having trouble displaying the data. My connection works fine, but my loop is jacked. Could anyone suggest or maybe correct a mistake (if you see any)? Just looking to see if I am started in the right direction, or if I have this all bass ackwards. I have no clue if this is even possible. I am looking to create a while loop for whatever query I run, and make each row equal to whatever field I put in. I have all variables defined within the scope of my class. Thanks for your help. Code : ******************************** function getdata() { $this->sql = $query; $result = mysql_query($query); $fetch = "mysql_fetch_array"; while ($row = $fetch($result)) { $this->field = $row['$this->field']; } if(!$result) { $this->error = mysql_error(); return; } } ****************************** End thanks!!! [ bryan fitch . programmer . bryan@concept-factory.com ]

« previous php.db (#7658) next »