I have a table named the_week
with 2 columns (week, id)
I'm using this SQL script to store to the db.
UPDATE the_week SET week = 0 WHERE id = '0'
To share more of my project I'm using wordpress so the usage is more with $wpdb
Basically, I want to increment the value every Thursday and save it to the db.
<?php $today = date("l"); ?>
<?php if ( strtolower($today) == 'thursday' ) { ?>
<?php $week_index++; ?>
<?php $wpdb->query( "UPDATE the_week SET week = $week_index WHERE id = '0' " ); ?>
<?php } ?>
Now I'm doing something wrong here because this code is running when the user visits the website and of course I don't need it to rely on that.
How can I do that?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…