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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T10:34:12+00:00 2026-06-06T10:34:12+00:00

I’m creating a simple questions DB, here are some details to start: 1st off,

  • 0

I’m creating a simple questions DB, here are some details to start:

1st off, I am not using PDO – it’s an old webapp, and this question is not about upgrading to PDO.

The DB

CREATE TABLE IF NOT EXISTS `questions` (
  `id` int(11) unsigned NOT NULL auto_increment,
  `question` varchar(255) NOT NULL,
  `userID` int(11) unsigned NOT NULL,
  `active` tinyint(1) NOT NULL default '1',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;

Already inside the DB:

INSERT INTO `apl_questions` (`id`, `question`, `userID`, `active`) VALUES
(1, 'Do you have a dog?', 1, 1),
(2, 'Have you ever been arrested?', 1, 1),
(3, 'Pick yes or no...', 1, 1);

The PHP

$questionsResult = mysql_query("select * from questions where userID = 1 AND active = 1"); // Get all activated questions
    if(mysql_num_rows($questionsResult) > 0){
        $questions = mysql_fetch_assoc($questionsResult);
        var_dump($questions);
    }

The RESULT (of the PHP)

array(4) { ["id"]=> string(1) "1" ["question"]=> string(18) "Do you have a dog?" ["userID"]=> string(1) "1" ["active"]=> string(1) "1" } 

As you can see, this is only grabbing the first row – when it should be grabbing all rows since the userID and “active” column of all 3 rows are 1. Anyone see anything here that could be causing this problem? If I put the query into PHP MyAdmin, the query works correctly – so I have to assume at this point that it’s the PHP… This is blowing my mind!

Thanks.

  • 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-06T10:34:14+00:00Added an answer on June 6, 2026 at 10:34 am

    It seems mysql_fetch_assoc is row fetching, opposite to bulk fetching, which means it will fetch row per row inside a given array.

    You have to loop over, for example in the php page:

    while ($row = mysql_fetch_assoc($result)) {
       echo $row["userid"];
       echo $row["fullname"];
       echo $row["userstatus"];
    }
    

    rgds.

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

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
I'm making a simple page using Google Maps API 3. My first. One marker
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
Specifically, suppose I start with the string string =hello \'i am \' me And
I am reading a book about Javascript and jQuery and using one of the
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I am doing a simple coin flipping experiment for class that involves flipping a

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.