How to display current inserted row find by current datetime

user3745274

I am trying to find the rows of the current record within a group of records for display in a view.ctp. My controller named Uploads. I have id, Up_Time and value in my database table. I decided to search by Up_Time. Up_Time is a field that will display current import time.

Currently i'm using below code find by id, it fail to display the rows of current record. Is there something that can do with Up_Time to display the current record?

$this->set('Uploads', $this->Upload->find('list', array ('fields' =>    
array('Upload.id'),'order' => array('Upload.id DESC');

Thanks in advance.

Alessandro Minoccheri

try to use all instead of list

like this:

$this->set('Uploads', $this->Upload->find('all', array ('fields' =>    
array('Upload.id'),'order' => array('Upload.id DESC')));

Method find list is used when you have to get value from database and print result inside a select option

In your query now you can print only id field pay attention, if you would like to print all row use this:

$this->set('Uploads', $this->Upload->find('all', array ('order' => array('Upload.id DESC')));

If you would like to take only the last try this:

$this->set('Uploads', $this->Upload->find('first', array ('order' => array('Upload.id DESC')));

UPDATE

If you would like to show last 5 records try this:

If you would like to take only the last try this using limit conditions:

$this->set('Uploads', $this->Upload->find('all', array ('order' => array('Upload.id DESC'), 'limit' => 5));

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Display a row of the current session

From Dev

Find by where NOT current row

From Dev

How to find the last observation in the next 10 seconds comparing to the current row?

From Dev

How to find the first smaller value compared to the current row in subsequent rows?

From Dev

How to find the last observation in the next 10 seconds comparing to the current row?

From Dev

How to find time difference in minutes from database last inserted record time and current time?

From Dev

Find the difference between previous row and current row

From Java

How to get the current time as datetime

From Dev

JS: how to get current datetime?

From Dev

Bind to current row data in a column display template

From Dev

DateTime List find last date that before current

From Dev

How to compare a previous DateTime with a current DateTime in JavaScript

From Dev

How to display the docker current configuration?

From Dev

How to display current mode IdeaVIM is in?

From Dev

How to display the name of the current Virtualenv?

From Dev

How to display the current keyboard layout?

From Dev

How to display current month as text

From Dev

How to display Current date in HTML?

From Dev

SQL Find difference between previous and current row

From Dev

Find first column text in current row

From Dev

Set a view's textbox (datetime field) to display readonly current datetime

From Dev

Set a view's textbox (datetime field) to display readonly current datetime

From Dev

sql query for difference between current row and previous row based on datetime

From Dev

How to find AVPlayer current bitrate

From Dev

How to find current template in meteor?

From Dev

How to find current UIViewController in Xamarin

From Dev

how to find the current version of gnome

From Dev

How to programmatically find the current value of DISPLAY when DISPLAY is unset? (for use in crontab)

From Dev

PHP Comparing Datetime object with current datetime and find smaller

Related Related

  1. 1

    Display a row of the current session

  2. 2

    Find by where NOT current row

  3. 3

    How to find the last observation in the next 10 seconds comparing to the current row?

  4. 4

    How to find the first smaller value compared to the current row in subsequent rows?

  5. 5

    How to find the last observation in the next 10 seconds comparing to the current row?

  6. 6

    How to find time difference in minutes from database last inserted record time and current time?

  7. 7

    Find the difference between previous row and current row

  8. 8

    How to get the current time as datetime

  9. 9

    JS: how to get current datetime?

  10. 10

    Bind to current row data in a column display template

  11. 11

    DateTime List find last date that before current

  12. 12

    How to compare a previous DateTime with a current DateTime in JavaScript

  13. 13

    How to display the docker current configuration?

  14. 14

    How to display current mode IdeaVIM is in?

  15. 15

    How to display the name of the current Virtualenv?

  16. 16

    How to display the current keyboard layout?

  17. 17

    How to display current month as text

  18. 18

    How to display Current date in HTML?

  19. 19

    SQL Find difference between previous and current row

  20. 20

    Find first column text in current row

  21. 21

    Set a view's textbox (datetime field) to display readonly current datetime

  22. 22

    Set a view's textbox (datetime field) to display readonly current datetime

  23. 23

    sql query for difference between current row and previous row based on datetime

  24. 24

    How to find AVPlayer current bitrate

  25. 25

    How to find current template in meteor?

  26. 26

    How to find current UIViewController in Xamarin

  27. 27

    how to find the current version of gnome

  28. 28

    How to programmatically find the current value of DISPLAY when DISPLAY is unset? (for use in crontab)

  29. 29

    PHP Comparing Datetime object with current datetime and find smaller

HotTag

Archive