Solved

mysql query:   name vs. order-based;  mysqli

Posted on 2013-01-16
3
360 Views
Last Modified: 2013-02-10
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

thanks!
0
Comment
Question by:willsherwood
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 38785983
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:
http://stackoverflow.com/questions/548986/mysql-vs-mysqli-in-php
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...
0
 

Author Comment

by:willsherwood
ID: 38787201
for #1,  are there any gotchas (or surprises) for converting back and forth  for _array  vs.   _index
0
 

Author Closing Comment

by:willsherwood
ID: 38874269
appreciate your help
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question