Jump to content

Recommended Posts

I have searched the forum, but I did not finda post that would help me with my issue.

 

I have a cron job that I am going to run every monday, however, I do not want to type out all of the dates into an if else statement, but would rather write it in a loop. I want to pull the date from the database table, which is always going to be a Thursday( and an ocassional Wednesday), and check to see if the Monday prior is todays date, and if it is, I want to pull the file tournament_id from my database and insert it into a variable. How can this be done? The date is in the following format: YYYY-MM-DD.

 

Thanks in advance for your help.

Link to comment
https://forums.phpfreaks.com/topic/271941-php-date-help/
Share on other sites

I am using strtotim() which I can get to work outside of my SQL query. How would I mkae this SQL statement work"

 

$today = strtotime(date('2013-01-07'));

$sql = "SELECT * FROM tournaments_2013 WHERE (strtotime('Last Monday', start_date) = $today)";

$result = mysql_query($sql);

print_r($result);
exit;

echo "<table><tr><th>Tournament</th></tr>";

   while($row = mysql_fetch_array($result))

 {

 echo "<tr><td>" . $row['tournament_id'] . "</td></tr>";

 }

echo "</table>";

Link to comment
https://forums.phpfreaks.com/topic/271941-php-date-help/#findComment-1399496
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.