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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T19:34:58+00:00 2026-06-14T19:34:58+00:00

This chunk of code was found in a script someone else wrote that I

  • 0

This chunk of code was found in a script someone else wrote that I was asked to edit. It doesn’t appear to be doing anything.. I’m wondering why on earth it was there and if something somewhere in the world would go terribly wrong if I remove it..

Am I missing something?

//begin mystery code - i have no idea what this chunk of code is doing..
$result = mysql_query("SHOW COLUMNS FROM ".$table."");
$i = 0;
if (mysql_num_rows($result) > 0) {
while ($row = mysql_fetch_assoc($result)) {
$i++;
}
}
//end mystery code

$result is not referenced anywhere else..

  • 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-14T19:35:00+00:00Added an answer on June 14, 2026 at 7:35 pm

    It does two things:

    1. Increasing $i per row.
    2. Storing each row into $row and finally false into it.

    So finally it sets:

    • $i to the number of rows.
    • $row to false

    But do not wonder about crap code much. Improve it instead:

    $i   = mysql_num_rows($result);
    $row = false;
    

    Also encapsulate mysql_* calls so you can easily replace them later. You should also handle the error case if the query fails.

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

Sidebar

Related Questions

This morning we found an old chunk of code that was causing a library
I have this chunk of code which I found and implemented according to http://www.activexperts.com/activmonitor/windowsmanagement/scripts/networking/windowsfirewall/
I'v been trying to anti alias with OGL. I found a code chunk that
I found this chunk of code on http://rosettacode.org/wiki/Multiple_regression#Python , which does a multiple linear
Graphael doesn't have an unhover event for some odd reason. Found this chunk of
I found a chunk of code that I haven't seen before: declare(ticks = 1);
I ran across this chunk of code (modified) in our application, and am confused
can anyone offer a selector to do away with this horrible chunk of code:
This is a chunk of javascript code from a tutorial where they are trying
If I have a chunk of code like this: .hover( function () { hoverState($(#navbar

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.