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

  • Home
  • SEARCH
  • 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 7640881
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T08:47:00+00:00 2026-05-31T08:47:00+00:00

This is a learning project for me and I have made a couple of

  • 0

This is a learning project for me and I have made a couple of inquiries on this site already which taught me quite a bit. But I am having problems with the “switch” routine and would appreciate any guidance I can muster. This switch routine was a suggestion but I get errors. I have done quite a bit of research but I still can’t figure out how to accomplish this process. I also don’t understand what the “@” means in “date_create(“@$qucls”)”. It doesn’t seem to matter if it is there or not but this was the suggestion along with the routine.

The queries check out as far as getting me what i want to produce but once I try to update the time strings, it gets bogged down.
The error is, “date_format() expects parameter 1 to be DateTime, boolean given in…”. As far as I know, $qucls should be a string of numbers not a true/false thing. There is definitely a number string in these table fields in the form of int.

Just to repeat other of my posts, I can’t change the database without going over my head. I need to take information from it to make email reminders from a calendar program. The tables are convoluted with unusual forms and lengths of date/time strings so there is much more to this script than appears here. In my process, this is where I am in figuring it out and it’s not too bad for a septuagenarian. I’ll go for cleaning it up after I figure out the processes that get the right outcome.

Here’s the applicable part of the script:

date_default_timezone_set('UTC');
$today = date("Ymd");
mysql_select_db($dbname);
$querydel = "SELECT cal_entry_id, cal_type FROM webcal_entry_log WHERE cal_type = 'D'";
$delqu = mysql_query($querydel);
$i = 0;
while ($row = mysql_fetch_array($delqu, MYSQL_NUM)) {
    $qudel[$i] = $row[0];
}
$query1 = "SELECT cal_id, cal_name, cal_date, cal_time, cal_type, cal_description FROM webcal_entry WHERE cal_type = 'M' AND cal_date != ' . $today . ' AND cal_id != " . $qudel[$i];
$wequ1 = mysql_query($query1);
while ($row = mysql_fetch_array($wequ1, MYSQL_NUM)) {
    $quid1[$i] = $row[0];
    $quname[$i] = $row[1];
    $qutime[$i] = $row[3];
    $qudesc[$i] = $row[5];

    $query2 = "SELECT cal_id, cal_type FROM webcal_entry_repeats WHERE cal_id = " . $quid1[$i];
    $wer1 = mysql_query($query2);
    if ($row = mysql_fetch_array($wer1, MYSQL_NUM)) {        
        $qutype[$i] = $row[1];
    }

    $query3 = "SELECT cal_id, cal_last_sent FROM webcal_reminders WHERE cal_id = " . $quid1[$i];
    $wer2 = mysql_query($query3);
    if ($row = mysql_fetch_array($wer2, MYSQL_NUM)) {
        $qucls[$i++] = $row[1];
    }
}
for ($j = 0; $j < $i; $j++) {
}
// date calculations - switch routine

$dateObj = date_create("@$qucls");

switch($qutype) {
  case "daily":
    date_add($dateObj, date_interval_create_from_date_string("1 day"));
    break;
  case "weekly":
    date_add($dateObj, date_interval_create_from_date_string("1 week"));
    break;
  case "monthly":
    date_add($dateObj, date_interval_create_from_date_string("1 month"));
    break;
  case "yearly":
    date_add($dateObj, date_interval_create_from_date_string("1 year"));
    break;
}

$qucls = date_format($dateObj, "U");

Thanks!

Edit: $qucls outputs an array of Unix time stamps as int() type after the query loop ends. Once it encouters – $dateObj = date_create(“@$qucls”) , $dateObj returns false. I can’t seem to find the trick.

  • 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-05-31T08:47:01+00:00Added an answer on May 31, 2026 at 8:47 am

    In looking at the code, it appears that $qucls is an array (based on the line $qucls[$i++] = $row[1];). date_create does not accept an array as the first parameter.

    The @ sign would indicate to date_create that you’re passing a unix timestamp.

    I’d recommend checking if ($dateObj === false) to see if date_create is returning a proper value.

    It also appears that $qutype is an array. Not really sure how switch reacts to being passed an array …

    Before you try to call date_create … you should print_r($qutype) and print_r($qucls) to make sure you know what kind of data you’re dealing with.

    So, are you trying to do something like this:

    foreach($qutype as $key => $type){
        $time    = $qucls[$key];
        $dateObj = date_create("@$time");
    
        switch($type) {
          case "daily":
            date_add($dateObj, date_interval_create_from_date_string("1 day"));
            break;
          case "weekly":
            date_add($dateObj, date_interval_create_from_date_string("1 week"));
            break;
          case "monthly":
            date_add($dateObj, date_interval_create_from_date_string("1 month"));
            break;
          case "yearly":
            date_add($dateObj, date_interval_create_from_date_string("1 year"));
            break;
        }
    
        $qucls[$key] = date_format($dateObj, "U");
    }
    

    You can do a print_r before and after the loop to ensure that all $qucls values are being updated …

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

Sidebar

Related Questions

I am learning Computer Networking this semester, on which I find it quite interesting
I have just started learning CXF. I made a maven archetype project through eclipse.
I was just designing this application and made many .aspx files which have my
Hey! This is what I have already done so far which works great: Download
I am a co-op student learning vb.net and I have a project which retrieves
I'm working on a project in C#, it's about E-learning.This project should use plug-ins
I am working on a small project for learning PHP better. This project has
I mean, this is Sakai , the open source project of a learning management
I have been learning python for some time now. While starting this learning python
I have been working on a little MVC project to assist in my self-learning

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.