note 44125 added to function.mysql-fetch-array

From: Date: Thu, 15 Jul 2004 16:57:48 +0000
Subject: note 44125 added to function.mysql-fetch-array
Groups: php.notes 
Request: Send a blank email to php-notes+get-73311@lists.php.net to get a copy of this message
I ran into this problem and I hope it helps other beginners out. If you're trying to use count() with mysql_fetch_array() you will get 2x as many elements (columns/lenght) returned. ie: If I have 2 columns 'lastname', 'firstname" I would get count() = 4. I believe this is because it returns both a numberic and an associative array by default. I used mysql_fetch_row() and I get the corrent number (in this example = 2). I haven't tried it with passing a 2nd parameter to fetch_array because I'd rather use the original function. Cheers ---- Manual Page -- http://www.php.net/manual/en/function.mysql-fetch-array.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+44125 Delete -- http://master.php.net/manage/user-notes.php?action=delete+44125&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+44125&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#73311) next »