Page 1 of 1

why does this do this?

Posted: Sat May 31, 2003 1:29 am
by nigma
Why does this method(the function is inside a class) print each column in the row twice?

Code: Select all

function PrintRows()
		{
			for ($this->counter = 0; $this->counter < $this->totalRows; $this->counter++)
			&#123;
				@mysql_data_seek($this->result, $this->counter) or error("Unable to seek out row $this->counter.");
				$this->data = mysql_fetch_array($this->result) or error("Unable to fetch array.");
			
				print '<tr>';
				foreach ($this->data as $this->col)
				&#123;
					print "<td>$this->col</td>";
				&#125;
				print '</tr>';
			&#125;
		&#125;

Posted: Sun Jun 01, 2003 1:08 pm
by volka
because mysql_fetch_array returns an array with both numerical and string-indexed elements.
try mysql_fetch_row instead