How to add two pages together

I was wondering how can I add two different pages together in php. For example, I would like to have the time variable on about.php and contact.php page and if I change the time from one page, it will affect the other page at the same time. Is it possible to do this from the mysql database?



3 Answers How to add two pages together

i think you can do that use require('filename') in PHP, that function/built in make yout get variabel, class etc from another file like you want to do . that the reference :

Hope can help

6 days ago

Here is my response.

The qusetion is, Do you want the time update to be real-time event or not.

Real-Time Event:

If you want the update to be real-time(Ie The Page will not refresh or reloads upon the event updates) then you better do it with nodejs and websocket. The most common websocket is Socket.Io.

Not-Realtime Event If its not gonna be real-time. You can then use php. You can write an update code in any of the page. You will then also write a code to query the time from the database. Embed the query codes on both pages so that each time the page reloads or refreshes, the time will be fetched from the database and it will work fine. Your best bet will be to combine php with ajax. Thanks You

6 days ago

You may use a session for making your pages stateful if that is what you are asking. In my opinion using database call for this purpose would be an overkill. Try setting a session variable for the domain and you may call that variable from any page of that domain.

Please visit these links for further reference for session variables: PHP Sessions across subpages of same domain

If using javascript/jquery, you may also have a look at this: One Cookie - Multiple Pages

6 days ago