How to implement the script

Started by jessepeterson, Aug 23, 2022, 01:10 AM

Previous topic - Next topic

jessepetersonTopic starter

I need a script that will look at the current date and display information from the database to the website from the string attached to this date (I hope it's clear). Those. there are only 365 records in the database and every day a new one should be displayed on the website depending on the date.
For example the script will look at date("N"); and, depending on the number, display info from a certain table row in the database.
  •  

autorenta

generally, you can do it without a database. Stuff 365 lines of text into a text document. The line number is the number of the day.
We check the annual number of the day, pull from the text document a line of text that equals the number of the day. And take it out where needed. You can simply include the script in the right place in your WordPress theme.
  •  

Nizam18

A table containing the DATE and DATETIME data types is created in the same way as other columns.
For instance, we can create a new table called orders, which contains columns of order number, ordered item, order date and order delivery date:

CREATE TABLE `MySampleDB`.`orders` (
  `order_no` INT  NOT NULL AUTO_INCREMENT,
  `order_item` TEXT  NOT NULL,
  `order_date` DATETIME  NOT NULL,
  `order_delivery` DATE  NOT NULL,
  PRIMARY KEY (`order_no`)
)
ENGINE = InnoDB;

The ORDER_DATE column is a MySQL DATETIME field in which we record the date and time when the order was made.
It is impossible to predict the exact time for the delivery date, so we only record the date.
  •