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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:36:30+00:00 2026-06-13T10:36:30+00:00

I want to show A result which requires Two previous queries; and as I

  • 0

I want to show A result which requires Two previous queries; and as I am trying to do this stuff with the new Mysqli interface, I don’t get it to work in the right way.

I have this, and the output is: Warning: mysqli::prepare() [mysqli.prepare]: All data must be fetched before a new statement prepare takes place

$qryRdmPh="SELECT `id` FROM `table` ORDER BY RAND() LIMIT 0,30";
$stmtRdmPh = $mysqli->prepare($qryRdmPh);
$stmtRdmPh->execute();
$stmtRdmPh->bind_result($id);
 while($stmtRdmPh->fetch()) {
 //Obtener el atributo Frase
 $qryPhVal="SELECT `id_v` FROM `values` WHERE `id_p`='" . $id . "'";
 $stmtPhVal = $mysqli->prepare($qryPhVal);
 $stmtPhVal->execute();
 $stmtPhVal->bind_result($idV);
  while($stmtPhVal->fetch()){
  echo $idV;
  }
 }

There must be another way to show results without so complex rules… I’ve read it’s very important to use Statement queries, but why? It makes my code just much longer and more complex.

Edit: I would really thank if someone explains me if statements are so important as said, and if I should use them always.

  • 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-13T10:36:31+00:00Added an answer on June 13, 2026 at 10:36 am

    There is always a possibility to do the same thing without nesting queries in this way. And what’s more… if you are doing it this way, it may harm your DB. Always try to get a simplier way.

    For example: If you want to do queries which depend on a current query, it would be better if you make a buffer and insert all rows after buffering.

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

Sidebar

Related Questions

I want to show the result in Label, I wrote a query by which
I have a problem which I don't understand. I want to show a simple
I have a grid that I want to show depending on the result of
my table have several records which has the same MemberID. i want to result
I have a db which contains french words and want to show them without
my code is here which is not returning the result i want var content
From my Eclipse plugin, I want to execute a command and show the results
I want show an information page after success db opartions. And after the info
I want show annotation view (above one of my pin) after load map. For
hii I want show a pop up Dialog box when i click on to

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.