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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T15:59:37+00:00 2026-06-18T15:59:37+00:00

I get datetime from this way: class DB_Functions extends DB_Connect{ private $dbConnect = ;

  • 0

I get datetime from this way:

class DB_Functions extends DB_Connect{

    private $dbConnect = "";
    public $dtime;

    public function __construct() {
        $this->dbConnect = $this->pdo_connect();
        $this->dtime = new DateTime();
    }

    public function destruct() {
        $this->dbConnect = null;
    }


    public function exampleInsert() {
        .
        .
        .
        $result->bindParam(':dateCreation',$this->dtime->format("Y-m-d H:i:s"),PDO::PARAM_STR);
    }
}

Then when I use dtime to insert in a table, like this:

Line 1708: $result->bindParam(':dateCreation',$this->dtime->format("Y-m-d H:i:s"),PDO::PARAM_STR);

Display this error:

<b>Strict Standards</b>:  Only variables should be passed by reference in <b>include\DB_Functions.php</b> on line <b>1708</b><br />

My declaration to get datetime is wrong?

  • 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-18T15:59:39+00:00Added an answer on June 18, 2026 at 3:59 pm

    The problem is that you are using bindParam() which actually binds a variable to the parameter in the query. This must be a variable, not a method call that returns a value.

    This allows for usage like:

    $value = 'somevalue';
    $result->bindParam(':some_field', $value);
    $value = 'someothervalue';
    $result->execute(); // executes query with 'someothervalue' passed as parameter.
    

    In your case you might want to use bindValue(). Which actually binds the value to the parameter in an immutable fashion. Either that or store your formatted datetime into a different class variable and continue to use bindParam() with that new variable.

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

Sidebar

Related Questions

My goal is to get a Time instance from a DateTime instance This has
This is the case. I get the date from DatePicker control: DateTime current =
Is there any other way to get datetime field from oracle database in 24hour
Given a domain object: class BirthdayDomain { public DateTime Birthday { get; set; }
Let's say I have an object: public class CustomObj { DateTime Date { get;
public class SearchForm { //Note: Property is nullable public DateTime? CurrentViewDate {get;set;} public DateTime
I get some datetime (ExactDate) from a db. These time are in US timezone,
How can I get DateTime value in C# from row, the current code is
I'm using the following to get utc datetime: import datetime import time from pytz
Code: class JobsManager(models.Manager): def get_active_by_category(self, cat, limit): import datetime from django.db.models import Q return

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.