site documentation
Posted in
4913
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
182
This Month
707
This Year
1513
Add Comment
Other Items in site documentation
function to load one latest item with a start val load_latest_single_num
make the view number zoom when mouse over or active
moving the hits widget into the post header and footer
for auto filled fields, need to change the text and background colours
use a list group for listing by category page [todo]
Comments Listing should be a custom list rather than using search
load the latest single item only
load oldest item based on insdate then update the insdate to now - load_latest_single_update
change this to a list group - other items
hero widget header - creates a nice looking hero item from a target uid and class
dropdown section
Latest from Code Widget
Related Search Terms
Other Categories in Code
alpine js apps c css factorio font awesome images linux quick modals sqlite site bugs site updates slick slider sliders testing windows apps apache api apps asp bat bootstrap bootstrap templates charts cookies core css css filters css grid design elements docker domains emoji fancybox fonts foundation framework gimp git html icons ideas image formatting images javascript javascript functions jquery js linux mac misc modals mysql nginx node php php errors php function php functions php simple html dom pi400 python react regex sections simple_html_dom simplepie php site bugs site documentation slick slider sql sqlite ssh sublime svg svg css templates tools virtual box vscode vue webdev windows windows 11 windows commands wordpress