note 78387 deleted from function.msql-fetch-row by cmb
| From: | cmb@php.net | Date: | Mon, 02 Nov 2020 15:22:42 +0000 |
| Subject: | note 78387 deleted from function.msql-fetch-row by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-215765@lists.php.net to get a copy of this message | ||
Note Submitter: markmcilroy at ozemail dot com dot au
----
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