note 78387 added to function.msql-fetch-row
| From: | markmcilroy at ozemail dot com dot au | Date: | Tue, 09 Oct 2007 23:28:39 +0000 |
| Subject: | note 78387 added to function.msql-fetch-row | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-131259@lists.php.net to get a copy of this message | ||
As an experienced programmer I recommend that new programmers do NOT use this function.
Use mqsql_fetch_array instead.
Using this function leads to code like:
<?php
$surname = $row[7];
?>
This is a dangerous coding practice and should be avoided.
Changing the original query can break existing code, often in subtle ways that leave
'sleeper' bugs in your system that take months to appear.
Using mysql_fetch_array allows you to write code like:
<?php
$surname = $data['surname'];
?>
This code will continue to run properly even columns are added to the originial query.
Also it is much easier to read and makes reading and modiying your code easier, reducing bugs.
Mark McIlroy
----
Server IP: 203.16.234.20
Probable Submitter: 203.24.6.121
----
Manual Page -- http://www.php.net/manual/en/function.msql-fetch-row.php
Edit -- https://master.php.net/note/edit/78387
Del: integrated -- https://master.php.net/note/delete/78387/integrated
Del: useless -- https://master.php.net/note/delete/78387/useless
Del: bad code -- https://master.php.net/note/delete/78387/bad+code
Del: spam -- https://master.php.net/note/delete/78387/spam
Del: non-english -- https://master.php.net/note/delete/78387/non-english
Del: in docs -- https://master.php.net/note/delete/78387/in+docs
Del: other reasons-- https://master.php.net/note/delete/78387
Reject -- https://master.php.net/note/reject/78387
Search -- https://master.php.net/manage/user-notes.php