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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:13:27+00:00 2026-06-17T08:13:27+00:00

How I can make 2 queries with mysqli_stmt? if I make it with one

  • 0

How I can make 2 queries with mysqli_stmt?
if I make it with one query if it works, but with two gives me this error:
“Fatal error: Call to a member function execute() on a non-object in.”

<?
$oConni=new mysqli('localhost', 'user', 'password', 'database');

$cQuery = "SELECT email, firstname, profile_image FROM usersg";
$stmt = $oConni->prepare($cQuery);
$stmt->execute();
$stmt->bind_result($email, $name, $imagen);

$cQuery2 = "SELECT oauth_uid, oauth_token, username, imagen FROM users";
$resul = $oConni->prepare($cQuery2);
$resul->execute();
$resul->bind_result($id, $fich, $nameTwi, $imagenTwi);

echo "<table border='1'>";
while ($stmt->fetch()) {
echo "<tr>
<td>" . $email. "</td>
<td>" . $name. "</td>
<td><img src='".$imagen."' width=40px height=40px></td>
</tr>";
}
echo "</table><p>";
echo "<table border='1'>";
while ($resul->fetch()) {
echo "<tr>
<td>" . $id. "</td>
<td>" . $fich. "</td>
<td>" . $nameTwi. "</td>
<td><img src='".$imagenTwi."' width=40px height=40px></td>
</tr>";
}
echo "</table>";
?>
  • 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-17T08:13:27+00:00Added an answer on June 17, 2026 at 8:13 am

    thry it, surely it will work !

    //First Query
    $cQuery = "SELECT email, firstname, profile_image FROM usersg";
    $stmt = $oConni->prepare($cQuery);
    $stmt->execute();
    $stmt->bind_result($email, $nombre, $imagen);
    echo "<table border='1'>";
     while ($stmt->fetch()) {
    echo "<tr>
    <td>" . $email. "</td>
    <td>" . $nombre. "</td>
    <td><img src='".$imagen."' width=50px height=50px></td>
    </tr>";
    }
    echo "</table>";
    
    //Second Query
    $cQuery2 = "SELECT oauth_uid, oauth_token, username, imagen FROM users";
    $resul = $oConni->prepare($cQuery2);
    $resul->execute();
    $resul->bind_result($id, $fichero, $nombreTwitter, $imagenTwitter);
    echo "<table border='1'>";
    while ($resul->fetch()) {
    echo "<tr>
    <td>" . $id. "</td>
    <td>" . $fichero. "</td>
    <td>" . $nombreTwitter. "</td>
    <td><img src='".$imagenTwitter."' width=50px height=50px></td>
    </tr>";
    }
    echo "</table>";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I make this two queries in one ? $query = SELECT *
In code igniter, you can connect database and make queries in controller like: $this->db->query(Your
How can i make multiple, composite query in oracle? for example this several queries
When i get this error: Call to a member function query() on a non-object
I have extended PHP's mysqli class, which works fine. But how can I make
I make two queries and I'd like to add rows from query 2 to
I can make a single row IKImageBrowserView by setting the [imageBrowser setContentResizingMask:NSViewWidthSizable]; but in
I can make a variable's name from two variables' value: $a = 'tea'; $b
I can make batch or vbs file on windows and run. this can automate
How can I make SQL queries from within emacs scripts to MySql then print

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.