473,748 Members | 2,578 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

inserting current date and time

Hello,

I have the following section of php code which updates a mysql record
from a form. For the values of livedate and livetime I need to insert
the current_date() and current_time() respectively.

When I run the code however it falls over at the line with

GetSQLValueStri ng(current_date (), "date")

The error is Fatal error: Call to undefined function: current_date()

any ideas?

Thanks,

td
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "frmaddsw") ) {
$updateSQL = sprintf("UPDATE software SET title=%s, shortdesc=%s,
`desc`=%s, version=%s, minreqs=%s, wareid=%s, catid=%s, hpage=%s,
dllink=%s, dlsize=%s, liveyn=%s, triallength=%s, price=%s, keywords=%s,
submitdate=%s, submittime=%s, livedate=%s, livetime=%s WHERE swid=%s",
GetSQLValueStri ng($_POST['title'], "text"),
GetSQLValueStri ng($_POST['shortdesc'], "text"),
GetSQLValueStri ng($_POST['desc'], "text"),
GetSQLValueStri ng($_POST['version'], "text"),
GetSQLValueStri ng($_POST['minreqs'], "text"),
GetSQLValueStri ng($_POST['wareid'], "int"),
GetSQLValueStri ng($_POST['catid'], "int"),
GetSQLValueStri ng($_POST['hpage'], "text"),
GetSQLValueStri ng($_POST['dllink'], "text"),
GetSQLValueStri ng($_POST['dlsize'], "text"),
GetSQLValueStri ng($_POST['liveyn'], "text"),
GetSQLValueStri ng($_POST['triallength'], "text"),
GetSQLValueStri ng($_POST['price'], "double"),
GetSQLValueStri ng($_POST['keywords'], "text"),
GetSQLValueStri ng($_POST['submitdate'], "date"),
GetSQLValueStri ng($_POST['submittime'], "date"),
// falls over here
GetSQLValueStri ng(current_date (), "date"),
GetSQLValueStri ng(current_time (), "date"),
//GetSQLValueStri ng($_POST['livedate'], "date"),
//GetSQLValueStri ng($_POST['livetime'], "date"),
GetSQLValueStri ng($_POST['swid'], "int"));
Jul 23 '05 #1
1 2081
Sam
I used the MySQL Administrator and created a table with a column called
import_date of type timestamp.
The default value is CURRENT_TIMESTA MP. Therefore when an entry is
inserted or updated, I do not
have to reference this field in my code. It is automatically updated via
mysql.

good luck
Jul 29 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2982
by: Jonathan Moss | last post by:
I have (almost) succesfully created a linked list data structure class. It will quite happily add items to to the end of the list (once I found that objects are not passed by reference :). What I am having problems with is inserting an item into the middle of the list. The code below is the addAfter function. As It's name suggests it is supposed to add a new list item after the one specified by $prev with what ever was after $prev now...
0
1478
by: Paolo Tardivel via DotNetMonster.com | last post by:
I have a databound datagrid containing template columns which allow editing of the values contained in the datagrid through the use of text boxes. One of the fields in the datagrid displays the time and date. When a row has been selected for editing I want to be able to click a button in the datagrid and update one of the text boxes with the current time and date. All the code for editing rows and getting the current time and date when...
15
18894
by: Khurram | last post by:
I have a problem while inserting time value in the datetime Field. I want to Insert only time value in this format (08:15:39) into the SQL Date time Field. I tried to many ways, I can extract the value in timeonly format by using this command Format(now,"HH:mm:ss") But when I insert it into the Sql Server database, it embadded date value with it. the output looks like that "01/01/1900 08:59:00" in that case time is
0
1239
by: Niketa Mahana | last post by:
Hi, We are in the process of making product in windows forms that is localized presently for all european countries.We are supposed to support all eastern and western european date , time and number formats.However we are currently facing a problem that say a user in Italy uses our product and user's settings have a "." as a time seperator sql server is unable to insert such time values into the database.We get an error for date-time...
2
1384
by: Paul | last post by:
I'm sure this isn't a difficult question, but I've been struggling trying to insert the current date into a sql server field. I've tried numerous suggestions that I've seen in newsgroups and everything either gives an error or puts 1/1/1900 in the field. The code I'm trying is: Dim sqlCMD As New SqlClient.SqlCommand("Insert Into tblNotificationStatus (UserName, ExpirationDate) values ('" & strUser & "','" &...
6
3306
by: fniles | last post by:
I am using VB.NET 2003 and SQL Server 2000. I have a table with a datetime column type. When inserting into the table for that column, I set it to Date.Now.ToString("T") , which is something like "2:50:54 PM". But after the row is inserted and I check the data in the database, the column data is set to "1/7/2007 2:50:04 PM" (notice today's date in front of the time). If I insert data directly into the table in the Enterprise Manager, the...
2
2307
by: Serious_Practitioner | last post by:
Hi, and thank you in advance for any assistance. I would like to use a script to determine if a date meets a condition, and, if it does, then create a table row with a couple of cells, and then put some text in the cells. I don't know if that is possible, so that's my first question. It seems to me that the HTML would have to be in the script, but I'm not experienced enough to know. The second question is how might I search for info...
13
3051
by: imnewtoaccess | last post by:
Hi, I am getting errors while inserting records in one table from another. These are the structures of two tables : file51tm_new RecordType Text
1
2015
by: assgar | last post by:
Hi I need help. I know what I want to accomplish, but I do not know how to do it. WHAT I NEED HELP ACCOMPLISHING: How to do I insert data into a table for a date range of two or more months, where every second or third week should be able to have different events/appointments.
0
8996
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8832
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9386
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9333
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9254
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8255
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6799
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.