E
E
eellazy2016-02-23 22:57:35
PHP
eellazy, 2016-02-23 22:57:35

How to save scroll position?

Hello! How can I save the positions of the scroll bar?
And now in more detail ...
I have a block in which words are displayed. The words are taken from the database. That is, in order, the words are arranged as follows:
word 5
word 4
word 3
word 2
word 1
When a new word is added, it is written at the end of this list. "Word 5" becomes "Word 6", "Word 4" becomes "Word 5" and so on. Everything that I add new, it is written down and to read it you need to scroll down. In fact, when I refresh the page, I always see the old post. How can I make it so that the information in the block would initially be scrolled down.
Oh... started writing but remembered.
When messages in a contact come in, we see new ones, and to read the old ones, scroll up. The same needs to be done.
Tell me how to organize it

<?php
                            include("config/config_database.php");
                            $result = mysql_query(" SELECT * FROM eb_notes ");
                            mysql_close();
                            while ($row = mysql_fetch_array ($result)) { ?>

                            
                                    <h1><?php echo $row ['description']; ?></h1>
                                    <h5><?php echo $row ['date']; ?></h5>
                                    <h5><?php echo $row ['time']; ?></h5>
                                
                        <?php }?>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor, 2016-02-23
@Igor_307

if I understand correctly, it is enough to add sorting to the query
SELECT * FROM eb_notes ORDER BY `id` DESC

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question