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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:44:42+00:00 2026-06-12T07:44:42+00:00

I have set dob as type date in my html and in my stu

  • 0

I have set dob as type “date” in my html and in my stu table i am taking it as a string so i have made it as varchar, but null is getting stored as default value

Check the code…

 /* Prepared statement, stage 1: prepare */
if (!($stmt = $mysqli->prepare("INSERT INTO `stu` (`name`, `gender` , `dob`) VALUES (
?, ?, ? ) "))) {
echo "Prepare failed: (" . $mysqli->errno . ") " . $mysqli->error;
}

/* Prepared statement, stage 2: bind and execute */

if (!$stmt->bind_param('sss', $name , $gender , $dob )) {
echo "Binding parameters failed: (" . $stmt->errno . ") " . $stmt->error;
}
  • 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-12T07:44:44+00:00Added an answer on June 12, 2026 at 7:44 am

    The code you posted is OK (though we can’t see if you actually execute() the query). The problem is the code that we can’t see, where you define $dob.

    When you pass $dob to bind_param() it should be a string, not an object or anything else that you might have. Format $dob as a string and that will enable it to be inserted into the table.

    I also suggest changing your field to a DATE instead of a VARCHAR. Your varchar field will accept any string date format but a DATE field will need YYYY-MM-DD.

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

Sidebar

Related Questions

i have a table dates (dob date, age number(4) ); I will insert a
I have a set of selects for a date of birth: <?php echo $this->Form->input('Profile.dob',
I have set onItemClicklistener on my custom list view but onItemClicklistener not working I
I have a table like this: create table t1 { person_id int, item_name varchar(30),
Ok so I have a table where we have custid, lastname, firstname, and DOB.
I have a link as follows. @Html.ActionLink(Create Report, Screenreport, Reports, null, new { @class
I have an ASP.net MVC model with a date: public class EditModel { [Display(Name=DOB)]
I am having a problem displaying/editing a date in MVC 3. I have set
i have an table customer CustomerID DOB 1 11/12/1983 2 12/12/1983 3 12/12/1985 34334
I have set the eclipse java formatter to wrap lines that exceed 120 characters

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.