[PHP] Re: mysql create table with date or timestamp
If you need date and hour the best way is: CREATE TABLE diary ( iddiary int auto_increment not null, imepriimek varchar(50), when timestamp, action varchar(30), onfile varchar(100) unique id(iddiary) ); if you need only date you can use: CREATE TABLE diary ( iddiary int auto_increment not null, imepriimek varchar(50), when date, action varchar(30), onfile varchar(100) unique id(iddiary) ); To get formated date you should use: select date_format(when, %T%W%e%c%y) from diary; To put data in this field you can use: insert into diary (when) values (str_to_date(10:55:14Thursday28509, %T%W%e%c%y)); -- João Cândido de Souza Neto SIENS SOLUÇÕES EM GESTÃO DE NEGÓCIOS Fone: (0XX41) 3033-3636 - JS www.siens.com.br Grega Leskovsek mavri...@gmail.com escreveu na mensagem news:1df2d4810905280643y62a0f092p91fa2c57558d8...@mail.gmail.com... CREATE TABLE diary(iddiary int auto_increment not null, imepriimek varchar(50), when date(%T%W%e%c%y), action varchar(30), onfile varchar(100) unique id(iddiary)); I tried the above and it didn't work. What must I do to create a table with full time and date. If I should use timestamp how do I convert thee timestamp in php back to normal time? (I also tried the mysql command: when timestamp and when date in the above first mysql clause but it didnt work ) Please help me. Thanks in advance, -- When the sun rises I receive and when it sets I forgive - http://users.skavt.net/~gleskovs/ All the Love, Grega Leskov'sek -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: mysql create table with date or timestamp
I GOT THIS ERROR when I tried first sample with when timestamp; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual thatcorresponds to your MySQL server version for the right syntax to use near 'id(iddiary) )' at line 1 2009/5/28 João Cândido de Souza Neto j...@consultorweb.cnt.br: If you need date and hour the best way is: CREATE TABLE diary ( iddiary int auto_increment not null, imepriimek varchar(50), when timestamp, action varchar(30), onfile varchar(100) unique id(iddiary) ); Please advice. Thanks in advance, Grega if you need only date you can use: CREATE TABLE diary ( iddiary int auto_increment not null, imepriimek varchar(50), when date, action varchar(30), onfile varchar(100) unique id(iddiary) ); To get formated date you should use: select date_format(when, %T%W%e%c%y) from diary; To put data in this field you can use: insert into diary (when) values (str_to_date(10:55:14Thursday28509, %T%W%e%c%y)); -- João Cândido de Souza Neto SIENS SOLUÇÕES EM GESTÃO DE NEGÓCIOS Fone: (0XX41) 3033-3636 - JS www.siens.com.br Grega Leskovsek mavri...@gmail.com escreveu na mensagem news:1df2d4810905280643y62a0f092p91fa2c57558d8...@mail.gmail.com... CREATE TABLE diary(iddiary int auto_increment not null, imepriimek varchar(50), when date(%T%W%e%c%y), action varchar(30), onfile varchar(100) unique id(iddiary)); I tried the above and it didn't work. What must I do to create a table with full time and date. If I should use timestamp how do I convert thee timestamp in php back to normal time? (I also tried the mysql command: when timestamp and when date in the above first mysql clause but it didnt work ) Please help me. Thanks in advance, -- When the sun rises I receive and when it sets I forgive - http://users.skavt.net/~gleskovs/ All the Love, Grega Leskov'sek -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- When the sun rises I receive and when it sets I forgive - http://users.skavt.net/~gleskovs/ All the Love, Grega Leskov'sek -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: mysql create table with date or timestamp
It´s not auto_increment, it´s auto increment. -- João Cândido de Souza Neto SIENS SOLUÇÕES EM GESTÃO DE NEGÓCIOS Fone: (0XX41) 3033-3636 - JS www.siens.com.br Grega Leskovsek mavri...@gmail.com escreveu na mensagem news:1df2d4810905280748uec4f425kaf14b6410caa...@mail.gmail.com... I GOT THIS ERROR when I tried first sample with when timestamp; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual thatcorresponds to your MySQL server version for the right syntax to use near 'id(iddiary) )' at line 1 2009/5/28 João Cândido de Souza Neto j...@consultorweb.cnt.br: If you need date and hour the best way is: CREATE TABLE diary ( iddiary int auto_increment not null, imepriimek varchar(50), when timestamp, action varchar(30), onfile varchar(100) unique id(iddiary) ); Please advice. Thanks in advance, Grega if you need only date you can use: CREATE TABLE diary ( iddiary int auto_increment not null, imepriimek varchar(50), when date, action varchar(30), onfile varchar(100) unique id(iddiary) ); To get formated date you should use: select date_format(when, %T%W%e%c%y) from diary; To put data in this field you can use: insert into diary (when) values (str_to_date(10:55:14Thursday28509, %T%W%e%c%y)); -- João Cândido de Souza Neto SIENS SOLUÇÕES EM GESTÃO DE NEGÓCIOS Fone: (0XX41) 3033-3636 - JS www.siens.com.br Grega Leskovsek mavri...@gmail.com escreveu na mensagem news:1df2d4810905280643y62a0f092p91fa2c57558d8...@mail.gmail.com... CREATE TABLE diary(iddiary int auto_increment not null, imepriimek varchar(50), when date(%T%W%e%c%y), action varchar(30), onfile varchar(100) unique id(iddiary)); I tried the above and it didn't work. What must I do to create a table with full time and date. If I should use timestamp how do I convert thee timestamp in php back to normal time? (I also tried the mysql command: when timestamp and when date in the above first mysql clause but it didnt work ) Please help me. Thanks in advance, -- When the sun rises I receive and when it sets I forgive - http://users.skavt.net/~gleskovs/ All the Love, Grega Leskov'sek -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- When the sun rises I receive and when it sets I forgive - http://users.skavt.net/~gleskovs/ All the Love, Grega Leskov'sek -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: mysql create table with date or timestamp
The problem was I didn't type a comma before unique id(iddary). Thanks to everybody for helping me on the seminar. Love, Grega 2009/5/28 LinuxManMikeC linuxmanmi...@gmail.com: Actually, AUTO_INCREMENT is the correct syntax for MySQL. I think the problem is NOT NULL should come first: iddiary INT NOT NULL AUTO_INCREMENT. 2009/5/28 João Cândido de Souza Neto j...@consultorweb.cnt.br: It´s not auto_increment, it´s auto increment. -- João Cândido de Souza Neto SIENS SOLUÇÕES EM GESTÃO DE NEGÓCIOS Fone: (0XX41) 3033-3636 - JS www.siens.com.br Grega Leskovsek mavri...@gmail.com escreveu na mensagem news:1df2d4810905280748uec4f425kaf14b6410caa...@mail.gmail.com... I GOT THIS ERROR when I tried first sample with when timestamp; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual thatcorresponds to your MySQL server version for the right syntax to use near 'id(iddiary) )' at line 1 2009/5/28 João Cândido de Souza Neto j...@consultorweb.cnt.br: If you need date and hour the best way is: CREATE TABLE diary ( iddiary int auto_increment not null, imepriimek varchar(50), when timestamp, action varchar(30), onfile varchar(100) unique id(iddiary) ); Please advice. Thanks in advance, Grega if you need only date you can use: CREATE TABLE diary ( iddiary int auto_increment not null, imepriimek varchar(50), when date, action varchar(30), onfile varchar(100) unique id(iddiary) ); To get formated date you should use: select date_format(when, %T%W%e%c%y) from diary; To put data in this field you can use: insert into diary (when) values (str_to_date(10:55:14Thursday28509, %T%W%e%c%y)); -- João Cândido de Souza Neto SIENS SOLUÇÕES EM GESTÃO DE NEGÓCIOS Fone: (0XX41) 3033-3636 - JS www.siens.com.br Grega Leskovsek mavri...@gmail.com escreveu na mensagem news:1df2d4810905280643y62a0f092p91fa2c57558d8...@mail.gmail.com... CREATE TABLE diary(iddiary int auto_increment not null, imepriimek varchar(50), when date(%T%W%e%c%y), action varchar(30), onfile varchar(100) unique id(iddiary)); I tried the above and it didn't work. What must I do to create a table with full time and date. If I should use timestamp how do I convert thee timestamp in php back to normal time? (I also tried the mysql command: when timestamp and when date in the above first mysql clause but it didnt work ) Please help me. Thanks in advance, -- When the sun rises I receive and when it sets I forgive - http://users.skavt.net/~gleskovs/ All the Love, Grega Leskov'sek -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- When the sun rises I receive and when it sets I forgive - http://users.skavt.net/~gleskovs/ All the Love, Grega Leskov'sek -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- When the sun rises I receive and when it sets I forgive - http://users.skavt.net/~gleskovs/ All the Love, Grega Leskov'sek -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: mysql create table with date or timestamp
On Thu, May 28, 2009 at 11:15, Andrew Ballard aball...@gmail.com wrote: Make that a 'comma', not the 'coma' that I seem to be in. :-) Eh, it's your birthday. You're allowed. ;-P Happy birthday, by the way. -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ 50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: mysql create table with date or timestamp
On Thu, May 28, 2009 at 11:15 AM, Andrew Ballard aball...@gmail.com wrote: 2009/5/28 Grega Leskovsek mavri...@gmail.com: I GOT THIS ERROR when I tried first sample with when timestamp; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual thatcorresponds to your MySQL server version for the right syntax to use near 'id(iddiary) )' at line 1 2009/5/28 João Cândido de Souza Neto j...@consultorweb.cnt.br: If you need date and hour the best way is: CREATE TABLE diary ( iddiary int auto_increment not null, imepriimek varchar(50), when timestamp, action varchar(30), onfile varchar(100) unique id(iddiary) ); Please advice. Thanks in advance, Grega There is a coma missing between the lines for the last column and the unique key. Andrew Make that a 'comma', not the 'coma' that I seem to be in. :-) Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: mysql create table with date or timestamp
On Thu, May 28, 2009 at 11:20 AM, Daniel Brown danbr...@php.net wrote: On Thu, May 28, 2009 at 11:15, Andrew Ballard aball...@gmail.com wrote: Make that a 'comma', not the 'coma' that I seem to be in. :-) Eh, it's your birthday. You're allowed. ;-P Happy birthday, by the way. Thanks! It's a weak excuse, but I'll take it. :-) Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php