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 3595830
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T19:54:15+00:00 2026-05-18T19:54:15+00:00

Whenever I try to post data values in PHP I get the following error:

  • 0

Whenever I try to post data values in PHP I get the following error:

Fatal error: Uncaught exception
‘Exception’ with message
‘DateTime::__construct() [datetime.–construct]: Failed to parse time string (this
wednesday G:i A) at position 16 (:):
Unexpected character’ in
C:\xampp\htdocs\keypad\end.php:14
Stack trace: #0
C:\xampp\htdocs\keypad\end.php(14):
DateTime->__construct(‘this wednesday
…’) #1 {main} thrown in
C:\xampp\htdocs\keypad\end.php on line
14

Here is the code I’m using:

<?php require_once('Connections/rent.php'); ?>
<?php

// post

$id = $_GET['id'];
$user = $_GET['user'];
$week = $_GET['week'];
$pRent = $_GET['pRent'];
$status = $_GET['status'];
$rentPaid = $_GET['rentPaid'];
$result = $_GET['result'];
$pDate = date("d/m/Y G:i A");
$lDate = new DateTime('this wednesday G:i A');
$cDate = new DateTime('next tuesday G:i A');

// update 

mysql_query("UPDATE rent SET dNo = '$dNo', pdate = '$pDate', pRent = '$result' WHERE rent.id = $id");


// if pRent = 0 then set status to clear, colour to #3C0
if ($pRent == 0 ) {
    mysql_query("UPDATE rent SET status = 'clear', colour = '#3C0' WHERE rent.id = $id");
} 

// if pRent =! 0 but just paid then set status to paid/not clear, colour to #FF0
elseif ($pRent =! 0 ) {
    mysql_query("UPDATE rent SET status = 'paid', colour = '#3C0' WHERE rent.id = $id");
}

// if status = on holiday, then set status to clear, colour to #3C0
elseif ($status == 'awaiting' ) {
    mysql_query("UPDATE rent SET status = 'awaiting', colour = '#09F' WHERE rent.id = $id");
} 

// check all drivers who have/have not paid rent in the past week
elseif ($lDate < $pDate && $cDate > $pDate) {
    //  date is within desired range
    mysql_query("UPDATE rent SET status = 'paid', colour = '#3C0'");
} else {
    // date is not within desired range
    mysql_query("UPDATE rent SET status = 'awaiting', colour = '#09F' WHERE rent.status =! 'not working'");
}
?>

Any suggestions?

  • 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-18T19:54:15+00:00Added an answer on May 18, 2026 at 7:54 pm

    You have a problem on line 14, $lDate = new DateTime('this wednesday G:i A') is invalid, take a look at Relative DateTime formats for a list of valid ones. What you need to do is:

     $lDate = new DateTime('this wednesday')
     $lDate->format('G:i A');
    

    Just a suggestion, first two lines should be

     <?php 
         require_once 'Connections/rent.php';
    

    And please consider using PDO or another similar library, or at least sanitize your SQL queries.

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

Sidebar

Related Questions

Whenever I try to post data values in PHP I get the following error:
I get this exception thrown whenever I try and submit data through a form
I get the above error whenever I try and use ActionLink ? I've only
I get an error whenever I try to create a simple edge from a
Whenever I try to install a Click Once application, I always get a 404
whenever I try to run something in Java, Eclipse changes into the PHP perspective.
Whenever I try to copy a file that's bigger than 2GB, I get an
Got this error whenever I try to compile something: F1027 Unit not found: 'System.pas'
Whenever I try to create a new rails app I get a permission denied
Whenever I try to add a new project to my SourceSafe repository it creates

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.