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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T21:47:51+00:00 2026-06-04T21:47:51+00:00

How do I print rows from my table in the MYSQL server when I

  • 0

How do I print rows from my table in the MYSQL server when I run the php file? I have used the prepare statement to prepare a query. I am not sure how to output the result of that query. My code is as follows:

// Check connection 
if (mysqli_connect_errno()) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    exit();
}

putenv("ODBCINI=/etc/dwwdwd.ini");
putenv("NZ_ODBC_INI_PATH=/etc/");
putenv("LD_LIBRARY_PATH=/export/home/joadf/netezza/lib64");
echo "Whats up";


$lvar = $coni->prepare(
    'SELECT * FROM TABLE A limit 10');
$lvar->execute();
$lvar->fetch();
?>
  • 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-04T21:47:54+00:00Added an answer on June 4, 2026 at 9:47 pm

    You are going to use bind_result() Doc. There are examples on that page. Basically you use bind result to set the variables where the data from the query is stored and then read them that way. You should put the fetch part inside a while loop so you can iterate over the results

    You will have n number of varaible within the bind_result() statement depending on how many cols you want from the db.

    Example if requesting 3 cols from db
    $lvar->bind_result($a, $b, $c);

    Now $a, $b, $c contain the data of the first row in the order that the cols are listed after calling $lvar->fetch().

    Each time you call $lvar->fetch() the variables are updated until there are no more rows at which case the fetch statement returns false

    This code should do the trick

    $lvar = $coni->prepare(
    'SELECT * FROM TABLE A limit 10');
    $lvar->execute();
    $lvar->bind_result($a, $b, $c);
    while($lvar->fetch()) {
        echo $a . $b . $c;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a php file which fetch and print data from my mysql table.
I am trying to insert multiple rows in a MySQL table from PHP arrays.
I have a mysql MyISAM table with many rows that contain information about places,
I have a table with ~100,000 rows. I am trying to print to screen
I'm trying to execute a basic INSERT statement on a MySQL table from a
I have some php querying and printing the info of a mysql table on
I am fetching some data from MySQL which I print into a table. I
I am trying to delete MySQL table rows from a Web page using Perl.
Hi there I'm trying to input 3 integers from the keyboard and print rows
I want to print some objects in a table having 2 rows per object,

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.