Posted in site documentation
3887
1:19 am, June 11, 2021
 

load oldest item based on insdate then update the insdate to now - load_latest_single_update

i keep finding these functions that i wrote ages ago and forgot about so ill list them here so maybe i can remember them.

I think this one was to loop through items, so it grabs the oldest item and then updates the insdate to now, so might be good for cycling through items depending on their insdate. 

PHP

// Load and Update Insdate or Processed Date
    // load oldest item based on insdate then update the insdate to now.
    public function load_latest_single_update() {
        $out = "";
        $db_table_name = $this->db->escapeString($this->db_table_name);
        //$uid = $this->db->escapeString($uid);
        $sql = "select * from $db_table_name order by insdate asc limit 1";
        $result = $this->db->query($sql);
        while($row = $result->fetchArray()) {
            $this->status = "Item Loaded";
            // auto load all items from the $load_array
            foreach($this->load_array as $load_title) {
                $this->$load_title = $row[$load_title];
            }
            $this->loaded = true;

            // set new insdate for loop
            $new_insdate = date("Y-m-d H:i:s");
            $this->insdate = $new_insdate;
            $this->update();

            return true;
        }
        return false;
    }

View Statistics
This Week
107
This Month
418
This Year
487

No Items Found.

Add Comment
Type in a Nick Name here
 
Search Code
Search Code by entering your search text above.
Welcome

This is my test area for webdev. I keep a collection of code here, mostly for my reference. Also if i find a good link, i usually add it here and then forget about it. more...

Subscribe to weekly updates about things i have added to the site or thought interesting during the last week.

You could also follow me on twitter or not... does anyone even use twitter anymore?

If you found something useful or like my work, you can buy me a coffee here. Mmm Coffee. ☕

❤️👩‍💻🎮

🪦 2000 - 16 Oct 2022 - Boots
Random Quote
When i was a little kid, I was really scared of the dark. But then I came to understand, dark just means the absence of photons in the visible wavelength -- 400 to 700 nanometers. Then i thought, well, its really silly to be afraid of a lack of photons. Then i wasn't afraid of the dark anymore after that.
Elon Musk
Random CSS Property

text-rendering

The text-rendering CSS property provides information to the rendering engine about what to optimize for when rendering text.
text-rendering css reference