[PHP] Re: Date Function - Empty Value
Torsten Roehr wrote: Gabe [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Torsten Roehr wrote: Gabe [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Torsten Roehr wrote: Gabe [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Environment: PHP 4.3.6 Access DB W2K IIS 5 I'm trying to store a date in a date/time field using the short date format ( m/d/ ). For some reason it won't let me post an empty value to that field in the DB. I've tried using empty quotes ( ) or NULL and I always get a datatype mismatch sql error. So then I just tried submitting a date that will never be used ( e.g. 1/1/ ). That works, but then when I try to read the date out of the field in the DB and format it using the date() function in PHP it doesn't display anything (which is fine with me). I read up on the date function on the PHP website and valid dates are limited from 01-01-1970 to 19-01-2038 on windows machines. So that explains why the function returns nothing. So, I guess my question is this: Is what I'm doing technically ok (using a date that's not in the valid range)? Or does anyone know of an empty date value that I can submit to the DB? Thanks! NULL should work if you have allowed it for the column when creating the table. Can you post your table structure? Regards, Torsten Well, I would, but I can't seem to figure out how to export just the structure out of access. Wouldn't NULL be allowed by default? This command should show you the table structure: SHOW CREATE TABLE tablename Please post the output. regards, Torsten Sorry Torsten, but you'll have to forgive my lack of understanding. Where should I put that command in? Thanks for you patience. In the mysql command line, if possible or if you're using phpMyAdmin. Should also work with mysql_query() in a php script and echoing out the result. Do you know how to do this? Regards, Torsten I'm using Microsoft Access for my database not MySQL. Does that change what I need to do? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Date Function - Empty Value
Gabe [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Torsten Roehr wrote: Gabe [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Torsten Roehr wrote: Gabe [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Torsten Roehr wrote: Gabe [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Environment: PHP 4.3.6 Access DB W2K IIS 5 I'm trying to store a date in a date/time field using the short date format ( m/d/ ). For some reason it won't let me post an empty value to that field in the DB. I've tried using empty quotes ( ) or NULL and I always get a datatype mismatch sql error. So then I just tried submitting a date that will never be used ( e.g. 1/1/ ). That works, but then when I try to read the date out of the field in the DB and format it using the date() function in PHP it doesn't display anything (which is fine with me). I read up on the date function on the PHP website and valid dates are limited from 01-01-1970 to 19-01-2038 on windows machines. So that explains why the function returns nothing. So, I guess my question is this: Is what I'm doing technically ok (using a date that's not in the valid range)? Or does anyone know of an empty date value that I can submit to the DB? Thanks! NULL should work if you have allowed it for the column when creating the table. Can you post your table structure? Regards, Torsten Well, I would, but I can't seem to figure out how to export just the structure out of access. Wouldn't NULL be allowed by default? This command should show you the table structure: SHOW CREATE TABLE tablename Please post the output. regards, Torsten Sorry Torsten, but you'll have to forgive my lack of understanding. Where should I put that command in? Thanks for you patience. In the mysql command line, if possible or if you're using phpMyAdmin. Should also work with mysql_query() in a php script and echoing out the result. Do you know how to do this? Regards, Torsten I'm using Microsoft Access for my database not MySQL. Does that change what I need to do? I'm not familiar with Access but should have an option or specific view to show you the table structure. Look at the Access program help for something like that. Regards, Torsten -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Date Function - Empty Value
On Thu, May 20, 2004 at 12:28:00PM -0400, Gabe wrote: I'm trying to store a date in a date/time field using the short date format ( m/d/ ). For some reason it won't let me post an empty value to that field in the DB. I've tried using empty quotes ( ) I'm using Microsoft Access for my database not MySQL. Does that change what I need to do? Access delimits dates with '#' hash marks. Try something like: UPDATE tablename SET date_field=#9/30/2003# WHERE foo='bar'; or UPDATE tablename SET date_field=NULL WHERE foo='bar'; if you want to make that field null. If it complains when you try to set it NULL and you want it to be null, put 'No' for 'Required' for that field in Design View. -Mark -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Date Function - Empty Value
Mark Pecaut wrote: On Thu, May 20, 2004 at 12:28:00PM -0400, Gabe wrote: I'm trying to store a date in a date/time field using the short date format ( m/d/ ). For some reason it won't let me post an empty value to that field in the DB. I've tried using empty quotes ( ) I'm using Microsoft Access for my database not MySQL. Does that change what I need to do? Access delimits dates with '#' hash marks. Try something like: UPDATE tablename SET date_field=#9/30/2003# WHERE foo='bar'; or UPDATE tablename SET date_field=NULL WHERE foo='bar'; if you want to make that field null. If it complains when you try to set it NULL and you want it to be null, put 'No' for 'Required' for that field in Design View. -Mark I'll give those a try. Thanks for the tips. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Date Function - Empty Value
Torsten Roehr wrote: Gabe [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Torsten Roehr wrote: Gabe [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Torsten Roehr wrote: Gabe [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Torsten Roehr wrote: Gabe [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Environment: PHP 4.3.6 Access DB W2K IIS 5 I'm trying to store a date in a date/time field using the short date format ( m/d/ ). For some reason it won't let me post an empty value to that field in the DB. I've tried using empty quotes ( ) or NULL and I always get a datatype mismatch sql error. So then I just tried submitting a date that will never be used ( e.g. 1/1/ ). That works, but then when I try to read the date out of the field in the DB and format it using the date() function in PHP it doesn't display anything (which is fine with me). I read up on the date function on the PHP website and valid dates are limited from 01-01-1970 to 19-01-2038 on windows machines. So that explains why the function returns nothing. So, I guess my question is this: Is what I'm doing technically ok (using a date that's not in the valid range)? Or does anyone know of an empty date value that I can submit to the DB? Thanks! NULL should work if you have allowed it for the column when creating the table. Can you post your table structure? Regards, Torsten Well, I would, but I can't seem to figure out how to export just the structure out of access. Wouldn't NULL be allowed by default? This command should show you the table structure: SHOW CREATE TABLE tablename Please post the output. regards, Torsten Sorry Torsten, but you'll have to forgive my lack of understanding. Where should I put that command in? Thanks for you patience. In the mysql command line, if possible or if you're using phpMyAdmin. Should also work with mysql_query() in a php script and echoing out the result. Do you know how to do this? Regards, Torsten I'm using Microsoft Access for my database not MySQL. Does that change what I need to do? I'm not familiar with Access but should have an option or specific view to show you the table structure. Look at the Access program help for something like that. Regards, Torsten After looking carefully through the table structure, it does allow NULL values. So maybe I'm not passing it correctly to the variables in the SQL. I thought I was -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Date Function - Empty Value
Gabe [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Environment: PHP 4.3.6 Access DB W2K IIS 5 I'm trying to store a date in a date/time field using the short date format ( m/d/ ). For some reason it won't let me post an empty value to that field in the DB. I've tried using empty quotes ( ) or NULL and I always get a datatype mismatch sql error. So then I just tried submitting a date that will never be used ( e.g. 1/1/ ). That works, but then when I try to read the date out of the field in the DB and format it using the date() function in PHP it doesn't display anything (which is fine with me). I read up on the date function on the PHP website and valid dates are limited from 01-01-1970 to 19-01-2038 on windows machines. So that explains why the function returns nothing. So, I guess my question is this: Is what I'm doing technically ok (using a date that's not in the valid range)? Or does anyone know of an empty date value that I can submit to the DB? Thanks! NULL should work if you have allowed it for the column when creating the table. Can you post your table structure? Regards, Torsten -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Date Function - Empty Value
Torsten Roehr wrote: Gabe [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Environment: PHP 4.3.6 Access DB W2K IIS 5 I'm trying to store a date in a date/time field using the short date format ( m/d/ ). For some reason it won't let me post an empty value to that field in the DB. I've tried using empty quotes ( ) or NULL and I always get a datatype mismatch sql error. So then I just tried submitting a date that will never be used ( e.g. 1/1/ ). That works, but then when I try to read the date out of the field in the DB and format it using the date() function in PHP it doesn't display anything (which is fine with me). I read up on the date function on the PHP website and valid dates are limited from 01-01-1970 to 19-01-2038 on windows machines. So that explains why the function returns nothing. So, I guess my question is this: Is what I'm doing technically ok (using a date that's not in the valid range)? Or does anyone know of an empty date value that I can submit to the DB? Thanks! NULL should work if you have allowed it for the column when creating the table. Can you post your table structure? Regards, Torsten Well, I would, but I can't seem to figure out how to export just the structure out of access. Wouldn't NULL be allowed by default? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Date Function - Empty Value
[snip] Well, I would, but I can't seem to figure out how to export just the structure out of access. Wouldn't NULL be allowed by default? [/snip] Do you have access to the mdb file? If you do you can just go into design view of the table to find out the data definitions. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Date Function - Empty Value
Matt Matijevich wrote: [snip] Well, I would, but I can't seem to figure out how to export just the structure out of access. Wouldn't NULL be allowed by default? [/snip] Do you have access to the mdb file? If you do you can just go into design view of the table to find out the data definitions. I do have access to the mdb but there's no way for me to export the structure that I'm looking at so I can send it to other people. Or do you know of a way? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Date Function - Empty Value
Gabe [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Torsten Roehr wrote: Gabe [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Torsten Roehr wrote: Gabe [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Environment: PHP 4.3.6 Access DB W2K IIS 5 I'm trying to store a date in a date/time field using the short date format ( m/d/ ). For some reason it won't let me post an empty value to that field in the DB. I've tried using empty quotes ( ) or NULL and I always get a datatype mismatch sql error. So then I just tried submitting a date that will never be used ( e.g. 1/1/ ). That works, but then when I try to read the date out of the field in the DB and format it using the date() function in PHP it doesn't display anything (which is fine with me). I read up on the date function on the PHP website and valid dates are limited from 01-01-1970 to 19-01-2038 on windows machines. So that explains why the function returns nothing. So, I guess my question is this: Is what I'm doing technically ok (using a date that's not in the valid range)? Or does anyone know of an empty date value that I can submit to the DB? Thanks! NULL should work if you have allowed it for the column when creating the table. Can you post your table structure? Regards, Torsten Well, I would, but I can't seem to figure out how to export just the structure out of access. Wouldn't NULL be allowed by default? This command should show you the table structure: SHOW CREATE TABLE tablename Please post the output. regards, Torsten Sorry Torsten, but you'll have to forgive my lack of understanding. Where should I put that command in? Thanks for you patience. In the mysql command line, if possible or if you're using phpMyAdmin. Should also work with mysql_query() in a php script and echoing out the result. Do you know how to do this? Regards, Torsten -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Date Function - Empty Value
Torsten Roehr wrote: Gabe [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Torsten Roehr wrote: Gabe [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Environment: PHP 4.3.6 Access DB W2K IIS 5 I'm trying to store a date in a date/time field using the short date format ( m/d/ ). For some reason it won't let me post an empty value to that field in the DB. I've tried using empty quotes ( ) or NULL and I always get a datatype mismatch sql error. So then I just tried submitting a date that will never be used ( e.g. 1/1/ ). That works, but then when I try to read the date out of the field in the DB and format it using the date() function in PHP it doesn't display anything (which is fine with me). I read up on the date function on the PHP website and valid dates are limited from 01-01-1970 to 19-01-2038 on windows machines. So that explains why the function returns nothing. So, I guess my question is this: Is what I'm doing technically ok (using a date that's not in the valid range)? Or does anyone know of an empty date value that I can submit to the DB? Thanks! NULL should work if you have allowed it for the column when creating the table. Can you post your table structure? Regards, Torsten Well, I would, but I can't seem to figure out how to export just the structure out of access. Wouldn't NULL be allowed by default? This command should show you the table structure: SHOW CREATE TABLE tablename Please post the output. regards, Torsten Sorry Torsten, but you'll have to forgive my lack of understanding. Where should I put that command in? Thanks for you patience. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Date Function - Empty Value
Gabe [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Torsten Roehr wrote: Gabe [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Environment: PHP 4.3.6 Access DB W2K IIS 5 I'm trying to store a date in a date/time field using the short date format ( m/d/ ). For some reason it won't let me post an empty value to that field in the DB. I've tried using empty quotes ( ) or NULL and I always get a datatype mismatch sql error. So then I just tried submitting a date that will never be used ( e.g. 1/1/ ). That works, but then when I try to read the date out of the field in the DB and format it using the date() function in PHP it doesn't display anything (which is fine with me). I read up on the date function on the PHP website and valid dates are limited from 01-01-1970 to 19-01-2038 on windows machines. So that explains why the function returns nothing. So, I guess my question is this: Is what I'm doing technically ok (using a date that's not in the valid range)? Or does anyone know of an empty date value that I can submit to the DB? Thanks! NULL should work if you have allowed it for the column when creating the table. Can you post your table structure? Regards, Torsten Well, I would, but I can't seem to figure out how to export just the structure out of access. Wouldn't NULL be allowed by default? This command should show you the table structure: SHOW CREATE TABLE tablename Please post the output. regards, Torsten -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Date Function in Php
Vinod Palan wrote: hi , Do any one have date functions like that we have in asp 1) Dateadd() 2) Datediff() etc? There are some classes in PEAR that may do what you want, take a look at Date Date::Calc. baba -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Date Function in Php
try mktime() function. -- Best regards, George Nicolae IT Manager ___ PaginiWeb.com - Professional Web Design www.PaginiWeb.com Vinod Palan [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... hi , Do any one have date functions like that we have in asp 1) Dateadd() 2) Datediff() etc? Thanks Vinod -- Vinod Palan A Calypso Technology, Inc. [EMAIL PROTECTED] (415) 817-2463 Phone -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Date function
[EMAIL PROTECTED] (Alia Mikati) wrote: Hello I have the following SQL and I wanna insert the current date in one of the table fields but it's not working. Can u tell me whats the problem? (I'm using mysql and php) Thx a lot $SQL = INSERT INTO orders (Customer_Id, Order_Date). VALUES($CustID,date()); try this: $SQL = INSERT INTO orders (Customer_Id, Order_Date). VALUES($CustID,' . date(m-d-Y) . '); -- Henrik Hansen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php