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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:22:48+00:00 2026-06-14T12:22:48+00:00

This function is supposed to return false when it fails, but in my case

  • 0

This function is supposed to return false when it fails, but in my case it isn’t returning anything, instead it crashes.

echo "This gets printed" ;
$x =  $db->query( "SELECT * FROM something WHERE id=123 AND name='abc'" );
echo "This does not get printed";

now if I echo the actual query string, copy paste it into mysql from the command line, it is a valid query. The only thing I can think of is that it might have to do with the fact that it is a recursive query, and it might be invalid to call $db->query twice in a row. Here is more or less my flow:

function recursiveQuery ( $result )
{
   $temp = array ();

   while ( $row = $result->fetch_assoc() )
   {
      $temp [ 'name' ] = $row [ 'name' ];
      $id = $row [ 'id' ];
      $temp [ 'sub' ] = recursiveQuery ( $db->query( "SELECT * FROM something WHERE parent_id=$id" ));
   }

   return $temp;
}

recursiveQuery ( $db->query( "SELECT * FROM something WHERE parent_id=0" ));

Is this not valid? How should I reorganize it?

  • 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-14T12:22:49+00:00Added an answer on June 14, 2026 at 12:22 pm

    Wow, I am such a fool. Turns out, the problem was scope, namely, $db was not accessible from inside recursive query

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

Sidebar

Related Questions

Primecheck function is supposed to return true or false whether passed number is prime
The function I'm calling with call_user_func is supposed to return FALSE. So how do
I have this function which is supposed to set a certain time format to
I've had trouble writing this code. I'm supposed to make a function that can
Why this example wont work: $string='1000000000000'; while($string=preg_replace('/(\d)((\d\d\d)+\b)/','$1,$2',$string)){} echo $string.<br>; It supposed that the loop
According to the documentation , socket_read() is supposed to return FALSE when the remote
I have this query that checks if a movement exists and supposed to return
I make this call in my application.js file but it doesn't seem to return
Suppose I have this function: void my_test() { A a1 = A_factory_func(); A a2(A_factory_func());
Suppose I have a utility function like this - public static boolean isABlankSpace(char c)

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.