Results 1 to 4 of 4

Thread: [RESOLVED] Date problem in PHP

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2006
    Location
    From the UK
    Posts
    422

    Resolved [RESOLVED] Date problem in PHP

    I would like to send an email out on a specific date (I will use cronjobs for this) and I'm testing this.

    Im trying to set the date and therefore send emails for records which match this date.

    $d="2008-12-04";

    However, when I echo that out it only returns '2008'. I can't think why, what is going on here??

  2. #2
    Frenzied Member the182guy's Avatar
    Join Date
    Nov 2005
    Location
    Cheshire, UK
    Posts
    1,473

    Re: Date problem in PHP

    That shouldn't echo '2008'.

    Can you show the rest of your code?
    Chris

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2006
    Location
    From the UK
    Posts
    422

    Re: Date problem in PHP

    Here's everything:

    $d="2008-12-04";

    Code:
    /* GET ALL REMINDERS FOR THIS DATE */
    $query="SELECT reminderid, callid FROM reminder WHERE duedate=? ORDER BY reminderid";
    $stmt = $mysqli->prepare($query);
    $stmt->bind_param('i', $d); 
    $stmt->execute(); 
    $stmt->bind_result($reminderid, $callid);
    $stmt->store_result();
    if ($stmt->num_rows>0) {
    while ($stmt->fetch()) {
    // DO STUFF
    }
    } else {
    	echo "nothing happened ";
    	echo $d;
    }

    The only output I see is:

    nothing happened 2008

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2006
    Location
    From the UK
    Posts
    422

    Re: Date problem in PHP

    Fixed::

    Problem was here

    Code:
    ('i', $d);
    since $d should be a string not integer.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width