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

  • SEARCH
  • Home
  • 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 9095271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T23:33:24+00:00 2026-06-16T23:33:24+00:00

Ive got a database that Im trying to pull data from (the name of

  • 0

Ive got a database that Im trying to pull data from (the name of each unique identifier and also how many times it appears in the database) by using this query:

$query = "SELECT Dcol, COUNT(*) FROM dtest GROUP BY Dcol";

and then using this to actually print the data out:

while($result->fetch_row()){

$row = $result->fetch_array(MYSQLI_NUM);
printf("<strong>%s</strong> : <i>%s</i><br />",$row[0],$row[1]);

}

and it works great except for the fact that it only gets 2 of the 4 unique items from the Dcol column. I’ve tested it by just putting everything that the fetch_row() returns into an array and then using print_r and when I do that it actually shows all 4 with the correct number of times it was used, but when I try to print it using the above statement I get 2 of the 4 (the second and fourth one, if that helps at all)

Can anyone tell me why this would only be giving two of the four unique items?

  • 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-06-16T23:33:25+00:00Added an answer on June 16, 2026 at 11:33 pm

    The ‘fetch_row’ command is getting the first row – then you ask for the 2nd row with the ‘fetch_array’ command. So you’re only seeing 2 and 4 as a result.

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

Sidebar

Related Questions

ive got 2 dropdown menu that retrieve the file from the database. but it
I’ve got a CursorAdapter that's built from a database Cursor and if a View
I've got a database that stores hash values and a few pieces of data
I've got a database that looks like this: ID Name ParentID 1 1 0
I'm trying to pull from a database 'retailers' and display them by country with
I'm trying to populate the pull down menu. so far ive got: <%@ Page
I've got a mysql database and I'm trying to put a url and unique
I've got a database like this one: I'm trying to create a query that
I've got a MySQL database that stores image information. Right now it only has
I've got a table in an Oracle 11g database that is similar to the

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.