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

  • Home
  • SEARCH
  • 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 4577076
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T20:17:45+00:00 2026-05-21T20:17:45+00:00

Background: We are launching a event which would be attended by students from various

  • 0

Background: We are launching a event which would be attended by students from various Universities. A web application would report live as to number of students registering for the event.

The basic web layout is

enter image description here

I hope the desired layout is clear. This needs to refresh every 5 mins to display as new students are registered. I have got the refresh part done
using Ajax setTimeout() method.

I have table Student. The query I am using is:

  SELECT UNIV, STUDENT_NAME, STUDENT_EMAIL
      FROM STUDENT
      ORDER BY UNIV;

However, the main issue is identifying when to add new row in the table and displaying the details
Issue 1: Currently, what I am doing is having $currUniv variable which refers to the current value of University. If the value of $currUniv and current row fetched don’t match, I create a new row

Code: in updater.php

function updateTable()
{
   $currUniv = "";
   while($currLine = mysql_fetch_array($results))
   {
      if (strcmp($currLine[0], $currUniv) != 0)
      {
         responseHTML .= "<tr id = \"{$currLine[0]}\">";
         responseHTML .= "<td id = \"{$GLOBALS["univ"]}\">";
         responseHTML .= "{$currLine[0]}";
         responseHTML .= "</td>";
         $currUniv = $currLine[0];
      }
         responseHTML .= "<td id = \"{$GLOBALS["studentname"]}\">";
         responseHTML .= "{$currLine[1]}";
         responseHTML .= "</td>";
         responseHTML .= "<td id = \"{$GLOBALS["studentemail"]}\">";
         responseHTML /= "{$currLine[2]}";
         responseHTML .= "</td>";
      if (strcmp($currLine[0], $currUniv) != 0)
      {
         responseHTML .= "</tr>";
      }
   }
}

Firstly, the table is not displayed. I don’t think this is the best algorithm to create the table. Can anyone suggest me any other means of achieving the same?

  • 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-05-21T20:17:45+00:00Added an answer on May 21, 2026 at 8:17 pm

    Looks like you don’t open enough tr and td tags if the university name matches the one from previous row. Make sure there is exactly the same number of tags generated in both cases. Preferably using else. Cells may be empty but you have to generate them.

    Also is there any valid reason you don’t sort your results by students name within one university? It’s just a small change in the query – ORDER BY UNIV, STUDENT_NAME.
    Without it you cannot rely on the order given to you by mysql, it will just throw students at whatever order it will think will be the fastest, especially when the table grows big.

    If this is the only thing you need to update it’s not complicated enough to give a reason to change your code into something you would have to learn from scratch.

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

Sidebar

Related Questions

I'm from PHP background. I used to use Apache, MySQL and PHP for web
Background: Some time ago, I built a system for recording and categorizing application crashes
Background I work for a large organization which has thousands of MS Access applications
I've got a C# winforms application that runs in the background, listening for hotkeys
Background: I have a JScript that runs when the computer starts up (from task
On Windows/.NET can you think of a way of somehow launching an existing application
Background: I have a little video playing app with a UI inspired by the
Background: At my company we are developing a bunch applications that are using the
Background: I need to reserve an amount of memory below 0xA0000 prior to my
Background I am writing and using a very simple CGI-based (Perl) content management tool

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.