* Chris Cocuzzo ([EMAIL PROTECTED]) [Dec 25. 2001 03:16]:
> here's the submit.php page ..which is the one that I suspect is giving me problems:
> case 'gigs':
> print "$date<br>";
> $date = strtotime($date);
> print "$date<br>";
> $query = "INSERT INTO gigs VALUES('0','$date','$location','$venue','$info')";
> break;
[...]
> +----------+---------------+------+-----+---------+----------------+
> | Field | Type | Null | Key | Default | Extra |
> +----------+---------------+------+-----+---------+----------------+
> | showid | mediumint(5) | | PRI | NULL | auto_increment |
> | date | timestamp(10) | YES | | NULL | |
Realize that, according to the mysql docs, timestamp(10) expects
its input to be in the format, YYMMDDHHMM.
> | location | varchar(40) | | | | |
> | venue | varchar(40) | | | | |
> | info | mediumtext | | | | |
> +----------+---------------+------+-----+---------+----------------+
> and when i query it i get this:
> +--------+------------+-----------------+--------------+-------+
> | showid | date | location | venue | info |
> +--------+------------+-----------------+--------------+-------+
> | 1 | 0000000000 | Framingham, Ma. | Denison Hall | -TBA- |
> +--------+------------+-----------------+--------------+-------+
And strtotime() is creating a different format. It's the the number of
non-leap seconds since epoch. I guess MySQL doesn't understand that, in
that situation.
> the date field is empty, but it should be filled. When i enter in the value for the
>date field in the form, I enter it as such: Jan 11, 2002 . I tested this beforehand
>and it worked. What the hell is wrong??
$date = strftime("%y%m%d%H%M", strtotime($date));
And that should produce, using your example:
<?php
print strftime("%y%m%d%H%M", strtotime("Jan 11, 2002"));
/* 0201110000 */
?>
See if that works..
--
Brian Clark | Avoiding the general public since 1805!
Fingerprint: 07CE FA37 8DF6 A109 8119 076B B5A2 E5FB E4D0 C7C8
SIGFUN -- signature too funny (core dumped)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]