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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T16:38:09+00:00 2026-05-24T16:38:09+00:00

I have a short code to get the results of a db_query into an

  • 0

I have a short code to get the results of a db_query into an array:

$r = db_query('SELECT vid FROM {node_revisions} WHERE nid = %d', $node->nid);
while ($vids[] = db_result($r));

The only problem is, that I get an empty array value:

Array(
   [] => 105
   [] => 409
   [] =>
)

How can I prevent the empty array value?

  • 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-24T16:38:10+00:00Added an answer on May 24, 2026 at 4:38 pm

    I found the shortest code to get all results from db_query in an array:

    for ($vid; $vid = db_result($r); $vids[] = $vid);
    

    The resulted array looks now like this:

    Array(
       [0] => 105
       [1] => 409
    )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently playing with reflection and I have problem with my short code: public
I have a short question i have wrote this in java. Old code: class
I have some basic PHP code: $raceramps56[short] = My Test Product; $leftMenu = '<div
I have this code to sort an array of objects. The data in the
I have some PHP code which allows me to sort a column into ascending
I have an app that needs to scan a barcode to get a code
I have been working with the example code from the ExecutorCompletionService and put together
I have an array of products that I'm pulling from the db. I've verified
I have a pList of strings which I'm bundling into an NSMutable Array. NSString
I have code like following: switch(sort.Column) { case code: model = (sort.Direction == SortDirection.Ascending)

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.