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
Solved

mysql query:   name vs. order-based;  mysqli

Posted on 2013-01-16
3
357 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
  • 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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

As a database administrator, you may need to audit your table(s) to determine whether the data types are optimal for your real-world data needs.  This Article is intended to be a resource for such a task. Preface The other day, I was involved …
I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

809 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