• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 364
  • Last Modified:

mysql query: name vs. order-based; mysqli

i'm inheriting code that i need to fix and add features to.
they use order-based queries and there are some bugs due to incorrect index order-matching with the SELECT argument list.

1.  mysql_fetch_array is used with $row[1]  where the index corresponds to the SELECT arg order.
     i'm accustomed to mysql_fecth_assoc  where the field name is used and order is inconsequential (and much more reliable for maintenance, etc.)

is there any aspect i should be aware of regarding converting from   _array     to    _assoc?
intuitively it seems trivial to just change the function name, and replace the index with $row['fieldname']
There are 33 fields in one query, so you can imagine the spaghetti code!

2.  is there any argument change between using  mysql and myslqi  system function calls?
can i just blindly substitute for all combinations of mysql_*  function names

  • 2
1 Solution
Guy Hengel [angelIII / a3]Billing EngineerCommented:
1/  => I also only use _array if by design of the relevant code, I will use the column by index, usually if there IS only 1 or 2 columns to be extracted.

2/ some input here:
my opinion is that if already you want to do the change, you should consider a rewrite using the full options of the new classes. otherwise you could as well leave the old code...
willsherwoodAuthor Commented:
for #1,  are there any gotchas (or surprises) for converting back and forth  for _array  vs.   _index
willsherwoodAuthor Commented:
appreciate your help
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now