note 54021 added to function.mysql-fetch-assoc

From: Date: Tue, 21 Jun 2005 08:58:00 +0000
Subject: note 54021 added to function.mysql-fetch-assoc
Groups: php.notes 
Request: Send a blank email to php-notes+get-90730@lists.php.net to get a copy of this message
To sum up moverton at northshropshiredc dot gov dot uk and Olivier Fabre: If the query is "SELECT something1, something2, .... FROM tbl WHERE some_condition", the keys in the returned array will be 'something1', 'something2', etc. *even for those "somethings" that are not just field names*. Examples of non-fieldname "somethings" are: NULL NOW MAX(some_fieldname) I haven't tested whether this applies to table.fieldname, but I see no reason why it shouldn't (I'd suspect a typo in my code if I didn't get the expected results; I certainly have had my share of them!) I found it most convenient to check for typos by simply var_dumping the resulting row, like this: <?php echo '<pre>Got this row:' var_dump ($row); echo '</pre>'; ?> where $row is the result from the last call to mysql_fetch_assoc. ---- Manual Page -- http://www.php.net/manual/en/function.mysql-fetch-assoc.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+54021 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+54021&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+54021&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+54021&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+54021&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+54021&report=yes&reason=non-english Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+54021&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+54021&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#90730) next »