saintex has asked for the wisdom of the Perl Monks concerning the following question:
The `message_has_been_sent` has been update, while `message_send` isn't updated.my $update="UPDATE `ml_message` SET `message_send`='N',`message_has_be +en_sent`='2010-12-06 10:59:20' WHERE `message_id`=3;"; $dbh->do($update) or die "problem while updating: $dbh->errstr \n";
-- -- Versione MySQL: 5.0.22 - SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; -- -- Database: `test` -- -- -------------------------------------------------------- -- -- Table schema `test_table` -- CREATE TABLE `test_table` ( `test_id` int(10) unsigned NOT NULL auto_increment, `test_cl_1` tinyint(1) NOT NULL, `test_cl_2` datetime default NULL, PRIMARY KEY (`test_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ; -- -- Data Dump for table `test_table` -- INSERT INTO `test_table` (`test_id`, `test_cl_1`, `test_cl_2`) VALUES (3, 1, '2010-12-07 14:01:28'), (4, 0, '2010-12-07 14:04:35');
use strict; use warnings; use DBI; use constant DB_HOST=>'localhost'; use constant DB_NAME=>'test'; use constant DB_USR=>'testUser'; use constant DB_PWD=>''; sub localDate { my $ora; unless (@_) { # se non ci sono parametri $ora=time; # ora e' il timestamp } else { $ora= shift @_; # altrimenti ora e' il primo parametro } my ($sec,$min,$hour,$mday,$mon,$year,$wday, $yday,$isdst)=localtime(time); sprintf "%4d-%02d-%02d %02d:%02d:%02d", $year+1900,$mon+1,$mday,$hour,$min,$sec; } my $dbh = DBI->connect( 'DBI:mysql:'.DB_NAME.':'.DB_HOST,DB_USR,DB_ +PWD) or die "Connecting : $DBI::errstr\n "; my $ora=&localDate; print "\n\n"; print 'date: '.$ora; print "\n\n"; my $update="UPDATE `test_table` SET `test_cl_1`=1,`test_cl_2`='$ora' W +HERE `test_id`=4;"; print "\n\n"; print $update; print "\n\n"; $dbh->do($update) or die "problem while updating: $dbh->errstr \n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: query problem
by Corion (Patriarch) on Dec 07, 2010 at 11:36 UTC | |
by saintex (Scribe) on Dec 07, 2010 at 11:58 UTC | |
|
Re: query problem
by JavaFan (Canon) on Dec 07, 2010 at 11:50 UTC | |
by saintex (Scribe) on Dec 07, 2010 at 12:05 UTC | |
by Corion (Patriarch) on Dec 07, 2010 at 12:13 UTC | |
by saintex (Scribe) on Dec 07, 2010 at 14:10 UTC | |
by marto (Cardinal) on Dec 07, 2010 at 14:22 UTC | |
by saintex (Scribe) on Dec 07, 2010 at 13:28 UTC | |
by marto (Cardinal) on Dec 07, 2010 at 13:33 UTC | |
by saintex (Scribe) on Dec 07, 2010 at 13:39 UTC | |
by Corion (Patriarch) on Dec 07, 2010 at 13:45 UTC | |
by marto (Cardinal) on Dec 07, 2010 at 13:46 UTC | |
|
Re: query problem
by locked_user sundialsvc4 (Abbot) on Dec 07, 2010 at 13:51 UTC |