Click here to get back home

inserting current date and time

 HomeNewsGroups | Search

get this group's latest topics as an RSS feed  mailing.database.mysql - MySQL database issues discussed in this best MySQL group in USENET

please rate
this thread
If you were  Registered and logged in, you could reply and use other advanced thread options
Posted by toedipper on July 20, 2005, 11:36 pm
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

GetSQLValueString(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",
                        GetSQLValueString($_POST['title'], "text"),
                        GetSQLValueString($_POST['shortdesc'], "text"),
                        GetSQLValueString($_POST['desc'], "text"),
                        GetSQLValueString($_POST['version'], "text"),
                        GetSQLValueString($_POST['minreqs'], "text"),
                        GetSQLValueString($_POST['wareid'], "int"),
                        GetSQLValueString($_POST['catid'], "int"),
                        GetSQLValueString($_POST['hpage'], "text"),
                        GetSQLValueString($_POST['dllink'], "text"),
                        GetSQLValueString($_POST['dlsize'], "text"),
                        GetSQLValueString($_POST['liveyn'], "text"),
                        GetSQLValueString($_POST['triallength'], "text"),
                        GetSQLValueString($_POST['price'], "double"),
                        GetSQLValueString($_POST['keywords'], "text"),
                        GetSQLValueString($_POST['submitdate'], "date"),
                        GetSQLValueString($_POST['submittime'], "date"),
// falls over here
GetSQLValueString(current_date(), "date"),
                        GetSQLValueString(current_time(), "date"),
                        //GetSQLValueString($_POST['livedate'], "date"),
                        //GetSQLValueString($_POST['livetime'], "date"),
                        GetSQLValueString($_POST['swid'], "int"));


Posted by Sam on July 29, 2005, 2:02 am
I used the MySQL Administrator and created a table with a column called
import_date of type timestamp.
The default value is CURRENT_TIMESTAMP. 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



Subject Author Date
inserting current date and time toedipper 07-20-2005
If you were  Registered and logged in, you could reply and use other advanced thread options
  • Subject
  • Date

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Driving a better car - Fuelzilla.com

Cabling site for homeowners and pros alike - Cabling-Design.com

1-Script XML SitemapXML Sitemap
Privacy Policy