P
P
ptaher2016-03-31 09:35:01
PHP
ptaher, 2016-03-31 09:35:01

Displaying the last row of a mysql table on a website page?

Hello, I need to output the last row from table tbl1, mysql database (name: sensor), to a website page.
The table has the following columns: id, temp, vlaj, datetime.
Please tell me what can be used, what commands, functions, or where you can read about it, at least from what to build on. In mysql and php full zero. I would really appreciate your help, thanks in advance.
ps If possible, it would be nice if you could help write the complete structure of this code.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
impos, 2016-03-31
@ptaher

The short algorithm is as follows.
1. Connect to the database (you can also work with MySQL via PDO or the mysql extension (deprecated and removed in php7))
2. Make a query
www.mysql.ru/docs/man/SELECT.html
3. Read the result from what will return item 2
4. Display the result on the page.

P
polar-bear, 2016-03-31
@polar-bear

SELECT * FROM tbl1 ORDER BY id DESC LIMIT 1

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question