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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T18:51:46+00:00 2026-06-10T18:51:46+00:00

After looking into it for a while I am struggling to use a hidden

  • 0

After looking into it for a while I am struggling to use a hidden form field and a PHP MS SQL Query to add the date uploaded to the database when the data is submitted. Something similar to the MySQL NOW() function. Which I have tried and doesn’t work. I also then tried the PHP date function.

<input type="hidden" name="DateUploaded" value="<?php date("d","m","y") ?>">

With my upload looking like this:

<?php 
 $Title=$_POST['Title'];
 $Synopsis=$_POST['Synopsis'];
  $Article=$_POST['Article'];
  $DateUploaded=$_POST['DateUploaded'];
  $Deleted=$_POST['Deleted'];
  mssql_connect("*************", "*********", "*********") or die; 
  mssql_select_db("DBName") or die; 
  mssql_query("INSERT INTO DBTable (Title, Synopsis, Article, DateUploaded,   Deleted) VALUES ('$Title','$Synopsis','$Article','$DateUploaded','$Deleted')"); 
  Print "Your information has been successfully added to the database."; 
   ?>

Its just a simple test blog DB, however when I try this technique I get this error:

Warning: mssql_query() [function.mssql-query]: message: Conversion failed when converting character string to smalldatetime data type. (severity 16) in (File Path) on line 9

I understand this is because im trying to put a string into a DB column set as smalldatetime. I was just wondering if there is a way around this that doesn’t involve me having to change the data type in the DB?

Any help would be appreciated.

  • 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-10T18:51:47+00:00Added an answer on June 10, 2026 at 6:51 pm

    Instead of using hidden field simply use date() of php like:

    $DateUploaded=date("Y-m-d H:i:s");
    

    Make sure your database filed has a date type.

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

Sidebar

Related Questions

I am looking into using Lucene.NET after reading some bad reviews of SQL Server's
after searching for a while I found the SQL query that gives me the
I'm working with someone who's looking to get back into programming after several years
After looking a while other google, and the web, I decided to post my
I am working on a php/mysql login system for a webproject. After looking through
While looking into the IndexedDB API, I have found several examples of event handlers
I've been running into a problem while trying to delete uploaded images. The error
After looking (Googling) on the web for a while, I can find nothing that
I'm trying to get back into rails after a while and am having a
NOTE: Originally had this listed as a memory leak. After looking into this deeper,

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.