Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8962505
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T16:08:28+00:00 2026-06-15T16:08:28+00:00

Ive got such script: mysql_connect(‘localhost’, ‘xxx’, ‘xxx’); mysql_select_db(‘xxx’); $sql = SELECT * FROM rl_cronjobs;

  • 0

Ive got such script:

mysql_connect('localhost', 'xxx', 'xxx');
mysql_select_db('xxx');

$sql = "SELECT * FROM rl_cronjobs";
$sql = mysql_query($sql);
$row = mysql_fetch_array($sql);

$sunday = $row['next_sunday'];
$today = date('Y-m-d');


if($sunday == $today){
    $sql = "DELETE * FROM xxx WHERE stala != 1";
    $sql = mysql_query($sql);
    echo $nextsunday;
    $nextsunday = strtotime("next Sunday");
    $nextsunday = date('Y-m-d', $nextsunday);   
    $sql = "UPDATE xxx SET next_sunday = $nextsunday";
    $sql = mysql_query($sql) or die (mysql_error());
    echo $nextsunday;
}

And in MySQL the value of it is: 1984
I need it to be normal date of next sunday

The type of MySQL table row is varchar because when i set tu date it doesn’t update. Any help?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T16:08:29+00:00Added an answer on June 15, 2026 at 4:08 pm

    Don’t store dates in varchar fields. Mysql has date, datetime, and timestamp fields for such things, and using them opens a world of new possibilities. E.g. your “next sunday” calculations can be done as simply as:

    UPDATE xxx SET next_sunday = NOW() + INTERVAL (8 - DAYOFWEEK(NOW())) DAY
    

    without ever involving the PHP time functions. Note that this particular function will always pick the real next sunday, so if you run this code on a Sunday, you’ll get the following weeks’ sunday, not “today”, e.g.:

    '2012-12-08' (Saturday) -> '2012-12-09'
    '2012-12-09' (Sunday)   -> '2012-12-16'
    '2012-12-10' (Monday)   -> '2012-12-16'
    

    As well, note that you’re trying to echo $nextsunday before it’s been defined.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got quite a few SQL statements like such: SELECT foo FROM things WHERE
I've got an AIX script I would like to run from a .NET application.
I've got such a function: void cleanup_module(void) { /* * Unregister the device */
I' ve got such a function static ssize_t read_mydevice(struct file *filp, char* buf, size_t
I've got a requirement such that, when a user logs in while completing a
I've got an enum defined as such: Private Enum AllowedMonthNumbers _1 _2 _3 _4
I've got some XML elements with a number attached as more are available. Such
I've got a class called Task. The header file goes as such: class Task
it's about Ruby. I've got a Box Object with attributes such as panel1, panel2,
I've been doing a prototype in WPF without using MVVM. It's got to such

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.