Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1076571
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T21:26:48+00:00 2026-05-16T21:26:48+00:00

My MySQL queries are returning arrays with duplicate entries: numbered keys and labeled keys

  • 0

My MySQL queries are returning arrays with duplicate entries: numbered keys and labeled keys with the same data inside. This may be standard, but it seems like a waste, and something that could cause problems if I’m printing values. I mean, not a huge problem, obviously. But I’m just curious if I can stop that. It seems unnecessary. For example:

Array(
    [0] => "Ted",
    [first_name] => "Ted",
    [1] => "Schmidlap",
    [last_name] => "Schmidlap"
)

And so on.

I’m pretty new to a lot of this, so this may be a simple question, but Googling doesn’t seem to have any answers for me. Anyone know the reason this happens? I’m using PHP’s PDO now, but I was doing it straight through the MySQL functions before and the same thing was happening, so I assume it’s a byproduct of MySQL interaction.

I can iterate through and unset the numeric ones, because I don’t need them, but they’re not really in the way right now, so that’s just an extra step. Still, is there a way to simply not have them fetched in the first place?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T21:26:50+00:00Added an answer on May 16, 2026 at 9:26 pm

    That depends on the function you are using.
    Some functions return both types, others return only one of them.

    If you are using PDOStatement->fetch, notice the optional $fetch_style argument it takes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i got 2 mysql queries, that retrieve the same data?, what one do you
My system runs some MySQL queries in PHP to retrieve data. The data that
one of my SQL queries is returning non-printable characters in the data because of
These two mysql queries return the same result set. Either gives me the results
How could I optimize this MySQL queries that is accessing two tables with more
Possible Duplicate: Are dynamic mysql queries with sql escaping just as secure as prepared
I'm performing the following MySQL query inside phpmyadmin. The found_rows() function is not returning
I am just getting started with MySQL queries, and have been fighting this for
I have tried several mySQL queries to compare a column of dates stored as
I have two mysql queries: $sql = SELECT * FROM content WHERE threadName LIKE

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.