?
Solved

mysql query:   name vs. order-based;  mysqli

Posted on 2013-01-16
3
Medium Priority
?
361 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 2000 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

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

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

In this blog post, we’ll look at how ClickHouse performs in a general analytical workload using the star schema benchmark test.
In this blog post, we’ll look at how using thread_statistics can cause high memory usage.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

752 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