strange MySQL result problem

From: Date: Fri, 17 Oct 2003 18:02:11 +0000
Subject: strange MySQL result problem
Groups: php.general 
Request: Send a blank email to php-general+get-166515@lists.php.net to get a copy of this message
Hey peeps. Let me be quick (or try to at least). Here is a snippet of my db class. function query($sql, $current_line) { $this->Result = mysql_query($sql) or die($this->stop($current_line)); // the following two lines work if they are in the next // method get_query_results() but not when they are in // this method. $this->Result_total_fields = mysql_num_fields($this->Result); $this->Result_total_rows = mysql_num_rows($this->Result); } function get_query_results() { $this->Result_Arr = array(); if($this->Result_total_rows > 0) { // initialize counter while($line = mysql_fetch_array($this->Result, MYSQL_BOTH)) { $this->Result_Arr[] = $line; } } mysql_free_result($this->Result); return $this->Result_Arr; } Ok. As the comments in the first method state, those two lines of code do not work* when they are used in the first method. If I put them down into the get_query_results() method they work fine. I can't figure out why this is happening since my code is syntactically correct. Chris. * By "do not work" I mean it throws the error "supplied argument is not a valid MySQL result resource". -- Don't like reformatting your Outlook replies? Now there's relief! http://home.in.tum.de/~jain/software/outlook-quotefix/

« previous php.general (#166515) next »