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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T20:44:04+00:00 2026-06-09T20:44:04+00:00

I was watching a tutorial series on PHP MySQLi this morning and I came

  • 0

I was watching a tutorial series on PHP MySQLi this morning and I came across a bit of code that the author of the series didn’t bother explain. I have seen this code before but never knew exactly how it works…

while ($row = $result->fetch_object()) {
    // set up a row for each record
    echo "<tr>";
    echo "<td>" . $row->id . "</td>";
    echo "<td>" . $row->firstname . "</td>";
    echo "<td>" . $row->lastname . "</td>";
    echo "<td><a href='records.php?id=" . $row->id . "'>Edit</a></td>";
    echo "<td><a href='delete.php?id=" . $row->id . "'>Delete</a></td>";
    echo "</tr>";
}

I know that its piecing together a table with the results of $result from a MySQL query but what I don’t get is, how does the while loop function with an assignment going on inside the parameters?

I tried to echo out $row = $result->fetch_object() but it didn’t display anything to the screen.

  • 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-09T20:44:05+00:00Added an answer on June 9, 2026 at 8:44 pm

    To debug queries don’t use echo.

    Use var_dump() or print_r()

    All your query is doing is looping and creating table rows populated with data from an sql table.

    The

    while ($row = $result->fetch_object()) {
    

    is simply generating a variable $row set to contents of 1 record (technically, with JOINs its more than 1 real “record”, but I doubt your using that here), then while you loop through you are printing the values of the columns with $row->id.

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

Sidebar

Related Questions

I was watching a Silverlight tutorial video, and I came across an unfamiliar expression
I was watching a Video tutorial according to the author CODE #2 should be
I'm trying RubyMine, and watching this tutorial https://www.jetbrains.com/ruby/documentation/ . The author uses there project->new->scaffold
I was watching this video tutorial and I noticed he said that he's added
ive been watching a tutorial that has told me to change the background color
I'm new to rails, and I'm watching this video tutorial online and I was
I've been watching this tutorial http://windowsclient.net/learn/video.aspx?v=296114 . At the very begining empty Windows forms
Ok while watching a tutorial I stupidly missed the part that you have to
so I was watching a tutorial and I am trying to understand this syntax
I was watching this AngularJS tutorial describing how to hook into Twitter with an

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.