Email address obfuscation in effect -- please
click here to turn it off.
[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
To everyone that helped thanks but I figured it out at about 3 this morning
here is what did it.
my $sql = "insert into users
(userid,cryptpassword,lastname,firstname,age,email,authtype,timecreated)VALU
ES('$userid','$cryptpassword','$lastname','$firstname','$age','$email', '3',
SYSDATE())";
As you can see by calling the SYSDATE() function for mySQL it already new
what I wanted to do and formats the TIMESTAMP to what the DATETIME type
wants to see. Supposedly NOW() does the same thing but I haven't tried it. I
figured out the way I had it concatinating it wouldn't call the function
right. So I just cut the fat and it worked. Its also works on a part that I
insert environmental variables (IP, BROWSER) into another table I made when
the user calls the CGI.
Thanks for the help anyway,
Ryan
-----Original Message-----
From: Curtis Jewell [mailto:EMAIL:PROTECTED]
Sent: Friday, December 07, 2001 10:01 AM
To: EMAIL:PROTECTED
Subject: Re: [MLUG] Perl & mySQL question (Dying, help)
John Engelbrecht wrote:
Make that 'man Date::Format' once the perl TimeDate distribution from
CPAN is installed - I LOVE Date::Format for these types of things! And,
I can test on any system, which I can't do if i backtick \bin\date!
--Curtis
> Personally, I think doing 'man strptime' is a whole lot easier.
> I've been playing with it to come up with Status program for my PalmVx
> so when My Palm logs in, it shows time and date in how ever type of
> format I want
>
> #include <time.h>
>
> char td_time[30],td_ltime[30], td_date[30], td_ldate[30];
>
> timedate()
> {
> struct tm *ptr;
> time_t ltime;
>
> ltime = time(NULL); /* get current calendar time */
> ptr = localtime(<ime); // return time in the form of tm structure
> strftime(td_date,30,"%I/%d/%Y (%A)",ptr);
> strftime(td_ldate,30,"%h %d, %Y (%j)",ptr);
> strftime(td_time,15,"%H:%M:%S",ptr);
> strftime(td_ltime,15,"%m:%M:%S",ptr);
> }
>
> On Thu, 6 Dec 2001, M. Kovalenko wrote:
>
> > "Davis, Ryan Wiley (UMC-Student)" wrote:
> > >
> > [...]
> > > my $createtime = (now());
> > [...]
> > > it is in the 0000-00-00 00:00:00 format (datetimecreated DATETIME NOT
NULL).
> >
> > I don't know of now() function in perl. I'd use localtime() (from man
> > perlfunc):
> >
> > $now_string = localtime; # result: "Thu Oct 13 04:54:34 1994"
> >
> > But if you're using DATETIME type for datetimecreated field and not
> > TEXT, I bet it requires specific format, like '12/6/2001' or something.
> > INSERT won't work like that. You'll have to do some text manipulation on
> > localtime() output or call `/bin/date` with the correct +FORMAT string.
> >
> > -- MK
> > --
> > To unsubscribe, go to http://mlug.missouri.edu/members/edit.php
> >
> > Archives are available at http://mlug.missouri.edu/list-archives/
> >
>
> --
> To unsubscribe, go to http://mlug.missouri.edu/members/edit.php
>
> Archives are available at http://mlug.missouri.edu/list-archives/
--
To unsubscribe, go to http://mlug.missouri.edu/members/edit.php
Archives are available at http://mlug.missouri.edu/list-archives/
--
To unsubscribe, go to http://mlug.missouri.edu/members/edit.php
Archives are available at http://mlug.missouri.edu/list-archives/