Jump to content

how to find the updated records in more than one table?


numan82

Recommended Posts

hi friends,

I am trying to clarify the logic to find the updates in various tables, let me explain it through code

 

Query = SELECT Std_Name,Std_Grade,Courses From [table][tr][td] Student A INNER JOIN [table][tr][td] Courses B

on A.Std_Id=B.Std_Id

Note: Std_Id is Primary key of [table][tr][td] Student and B.Std_Id as Foreign Key in [table][tr][td] Courses

after all I get this result.

if there is some modification in these two tables, like student name changes or coures changes, than

How Would I know the changes.... is it bit confusing?

the one Idea, I've is to make new table and insert this generated query into that, and every time I run this new query I need to compare this new query with the old values saved in the tables

Link to comment
Share on other sites

This question belongs in the MySQL/SQL boards, not in the OOP help.

Nevertheless I shall answer your question:

 

HTTP is a stateless protocol, thus each request for information (a page) is separate, and maintains no persistent information, even if the database at the backend changes. Thus the short answer to your question is; you can't do what you want. The page is required to be refreshed by the user to see the new information. The long answer is that "YES" you can do it, but it requires the use of Ajax. i.e. every few seconds you need to query the database for the same information, and if it changes update the DOM with the new information.

 

Why do you wish to have this implementation? You're working with websites, not standalone programs. I can see no direct benefit to the end user, and you had best consider the additional number of database queries/http requests that MySQL and Apache will have to make to maintain this information.

 

For example, say 10 users all connect simultaneously, and they all go to the page which shows their name/grade/courses information. If you have an Ajax query that fires every 10 seconds say, then every 10 seconds you're initiating a connection to Apache, and performing a database call.

 

Consider a real life example, ebay has a "refresh" button available on all their auction items (if you're bidding on it) which refreshes the page at the users request giving them the latest information.

 

I'll leave it up to you to decide why you want what you do, but i have provided the arguments against such an approach, and suggested an alternative.

Link to comment
Share on other sites

Hi Thanks for the detail comments!

But I've different situation and the situation is, I am using socket programming in PHP and sending data from client script to server Database and Server Database is storing it.

so in this case, in the begining I am sent all the data and now in client if there are some updates I want to get that updates and want to send it to server.

This is not website, but infact client/server application that sends data from client to server.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.