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 6155201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:23:47+00:00 2026-05-23T20:23:47+00:00

So, I have a database (With a table called users) that let’s users connect

  • 0

So, I have a database (With a table called users) that let’s users connect accounts, and it goes by their usernumber to find their accounts, let’s say (With values):

Usernumber|Username|Email
-------------------------
1 | Justin | email@email.com
2 | Test | test@test.com
2 | Hi | gah@goo.com
1 | Foo | hey@hey.com
1 | Bar | Du@de.com

Now, in PHP, I do:

$stuff = mysql_fetch_array(mysql_query("SELECT * FROM users WHERE usernumber=1"));

Now, I do count($stuff); and it returns 14, all the time, whether I do it with usernumber one or two… I can’t figure out the problem, but I was wondering if someone else sees it, or knows something that I don’t about how certain files are configured (Limits or something?). I’m using XAMPP to test everything right now.

ALSO, when I do the $stuff in PHPMYADMIN as a SQL in the table, it does return all the values it should.

So question is: What am I missing and how do I get it return all the values and not just 2 rows? (The table has 7 columns).

Thanks,
Justin W.

  • 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-23T20:23:49+00:00Added an answer on May 23, 2026 at 8:23 pm

    By default, mysql_fetch_array will return a combined indexed array of columns (0 – 6) and associative array (column_name => value)

    That is why you have 14 values for that row (7 that are numerically indexed, 7 that are associatively indexed).

    Also, you only get one row per function call. 14 is the number of columns (7 * 2), not the number of rows.

    You need to start holding your MySQL result resource in its own variable:

    $result = mysql_query("SELECT * FROM users WHERE usernumber=1");
    

    That way you can call mysql_fetch_array multiple times on that resultset. Also, you can check the number of rows by calling mysql_num_rows($result)

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

Sidebar

Related Questions

I have a table called Users in my database. Let's assume that User has
Let's say I have an edit view that is strongly-typed to a table called
I have a database table called users This table has two columns (that are
Say I have a database called Poll and have these two table structures. poll
Lets say I have a table in a sql server 2000 database called TransactionType:
Let's say I have a USER table, and each my database is to handle
I have a database table called users with a primary key of user_id for
I have a database table called Posts which stores all the information regarding an
I have a simple database table called Entries: class CreateEntries < ActiveRecord::Migration def self.up
I'm binding a gridview dynamically from a table in my database I have called

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.