data_registre 20031120231019 --> data_ultima_connexio 20031120231019 ** UPDATE usuaris SET data_ultima_connexio = '20031120231112' WHERE userid = 'test' ** SELECT * FROM usuaris WHERE userid = 'test' --> data_registre 20031120231112 --> data_ultima_connexio 20031120231112 The PHP statements are exactly those that begin with **, and --> shows a subset of a results received. As you can see, the last update modifies both data_registre and data_ultima_connexio. These updates and selects run alone and in sequential mode, so data_registre should be always the same. I really don't figure where is the problem. Moreover I add the table definition. CREATE TABLE usuaris (userid VARCHAR(16), nom_complet VARCHAR(64) NOT NULL, correu VARCHAR(64) NOT NULL, data_registre TIMESTAMP(14) NOT NULL, data_ultima_connexio TIMESTAMP(14), data_ultima_fallada TIMESTAMP(14), paraula_de_pas VARCHAR(32) NOT NULL, privilegis VARCHAR(255), fallades INTEGER NOT NULL, PRIMARY KEY (userid)); Has anyone any idea that could solve this problem? Thanks in advance. -- ________________________________________________________________________ Harald Servat Gelabert (harald at cepba dot upc dot es) o//o Centre Europeu de Paral.lelisme de Barcelona CEPBA o//o [url]WWW...:[/url] [url]http://www.cepba.upc.es[/url] Tel: +34-93-401 74 23 o//o e-mail: [email]suport@cepba.upc.es[/email] Fax: +34-93-401 25 77 o//o CEPBA c/Jordi Girona, 1-3, Ṃdul D6. E-08034 Barcelona, Catalunya ________________________________________________________________________ The fundamental difference between Unix and Macintosh operating system is that Unix was designed to please programmers, whereas the Mac was designed to please users. (Windows, on the other hand, was designed to please accountants, but that's another story) -- from The UNIX haters handbook, page 163 [allowsmilie] => 1 [showsignature] => 0 [ipaddress] => [iconid] => 0 [visible] => 1 [attach] => 0 [infraction] => 0 [reportthreadid] => 0 [isusenetpost] => 1 [msgid] => <3FBDE2E4.952EB49E@cepba.upc.es> [ref] => [htmlstate] => on_nl2br [postusername] => Harald Servat Gelabert [ip] => harald@cepba.up [isdeleted] => 0 [usergroupid] => [membergroupids] => [displaygroupid] => [password] => [passworddate] => [email] => [styleid] => [parentemail] => [homepage] => [icq] => [aim] => [yahoo] => [msn] => [skype] => [showvbcode] => [showbirthday] => [usertitle] => [customtitle] => [joindate] => [daysprune] => [lastvisit] => [lastactivity] => [lastpost] => [lastpostid] => [posts] => [reputation] => [reputationlevelid] => [timezoneoffset] => [pmpopup] => [avatarid] => [avatarrevision] => [profilepicrevision] => [sigpicrevision] => [options] => [akvbghsfs_optionsfield] => [birthday] => [birthday_search] => [maxposts] => [startofweek] => [referrerid] => [languageid] => [emailstamp] => [threadedmode] => [autosubscribe] => [pmtotal] => [pmunread] => [salt] => [ipoints] => [infractions] => [warnings] => [infractiongroupids] => [infractiongroupid] => [adminoptions] => [profilevisits] => [friendcount] => [friendreqcount] => [vmunreadcount] => [vmmoderatedcount] => [socgroupinvitecount] => [socgroupreqcount] => [pcunreadcount] => [pcmoderatedcount] => [gmmoderatedcount] => [assetposthash] => [fbuserid] => [fbjoindate] => [fbname] => [logintype] => [fbaccesstoken] => [newrepcount] => [vbseo_likes_in] => [vbseo_likes_out] => [vbseo_likes_unread] => [temp] => [field1] => [field2] => [field3] => [field4] => [field5] => [subfolders] => [pmfolders] => [buddylist] => [ignorelist] => [signature] => [searchprefs] => [rank] => [icontitle] => [iconpath] => [avatarpath] => [hascustomavatar] => 0 [avatardateline] => [avwidth] => [avheight] => [edit_userid] => [edit_username] => [edit_dateline] => [edit_reason] => [hashistory] => [pagetext_html] => [hasimages] => [signatureparsed] => [sighasimages] => [sigpic] => [sigpicdateline] => [sigpicwidth] => [sigpicheight] => [postcount] => 1 [islastshown] => [isfirstshown] => 1 [attachments] => [allattachments] => ) --> data_registre 20031120231019 > --> data_ultima_connexio 20031120231019 > > ** UPDATE usuaris SET data_ultima_connexio = '20031120231112' WHERE > userid = > 'test' > ** SELECT * FROM usuaris WHERE userid = 'test' > --> data_registre 20031120231112 > --> data_ultima_connexio 20031120231112 > > The PHP statements are exactly those that begin with **, and --> shows a > subset of a results received. > > > As you can see, the last update modifies both data_registre and > data_ultima_connexio. These updates and selects run alone and in > sequential > mode, so data_registre should be always the same. > > I really don't figure where is the problem. Moreover I add the table > definition. > > CREATE TABLE usuaris (userid VARCHAR(16), > nom_complet VARCHAR(64) NOT NULL, > correu VARCHAR(64) NOT NULL, > data_registre TIMESTAMP(14) NOT NULL, > data_ultima_connexio TIMESTAMP(14), > data_ultima_fallada TIMESTAMP(14), > paraula_de_pas VARCHAR(32) NOT NULL, > privilegis VARCHAR(255), > fallades INTEGER NOT NULL, > PRIMARY KEY (userid)); > > Has anyone any idea that could solve this problem?[/quote] TIMESTAMP columns are automatically updated whenever you modify the row. Change the TIMESTAMP columns to DATETIME. -- Tom Thackrey [url]www.creative-light.com[/url] tom (at) creative (dash) light (dot) com do NOT send email to [email]jamesbutler@willglen.net[/email] (it's reserved for spammers) [allowsmilie] => 1 [showsignature] => 0 [ipaddress] => [iconid] => 0 [visible] => 1 [attach] => 0 [infraction] => 0 [reportthreadid] => 0 [isusenetpost] => 1 [msgid] => <1Spvb.14603$0A3.8630@newssvr29.news.prodigy.com> [ref] => <3FBDE2E4.952EB49E@cepba.upc.es> [htmlstate] => on_nl2br [postusername] => Tom Thackrey [ip] => use.signature@n [isdeleted] => 0 [usergroupid] => [membergroupids] => [displaygroupid] => [password] => [passworddate] => [email] => [styleid] => [parentemail] => [homepage] => [icq] => [aim] => [yahoo] => [msn] => [skype] => [showvbcode] => [showbirthday] => [usertitle] => [customtitle] => [joindate] => [daysprune] => [lastvisit] => [lastactivity] => [lastpost] => [lastpostid] => [posts] => [reputation] => [reputationlevelid] => [timezoneoffset] => [pmpopup] => [avatarid] => [avatarrevision] => [profilepicrevision] => [sigpicrevision] => [options] => [akvbghsfs_optionsfield] => [birthday] => [birthday_search] => [maxposts] => [startofweek] => [referrerid] => [languageid] => [emailstamp] => [threadedmode] => [autosubscribe] => [pmtotal] => [pmunread] => [salt] => [ipoints] => [infractions] => [warnings] => [infractiongroupids] => [infractiongroupid] => [adminoptions] => [profilevisits] => [friendcount] => [friendreqcount] => [vmunreadcount] => [vmmoderatedcount] => [socgroupinvitecount] => [socgroupreqcount] => [pcunreadcount] => [pcmoderatedcount] => [gmmoderatedcount] => [assetposthash] => [fbuserid] => [fbjoindate] => [fbname] => [logintype] => [fbaccesstoken] => [newrepcount] => [vbseo_likes_in] => [vbseo_likes_out] => [vbseo_likes_unread] => [temp] => [field1] => [field2] => [field3] => [field4] => [field5] => [subfolders] => [pmfolders] => [buddylist] => [ignorelist] => [signature] => [searchprefs] => [rank] => [icontitle] => [iconpath] => [avatarpath] => [hascustomavatar] => 0 [avatardateline] => [avwidth] => [avheight] => [edit_userid] => [edit_username] => [edit_dateline] => [edit_reason] => [hashistory] => [pagetext_html] => [hasimages] => [signatureparsed] => [sighasimages] => [sigpic] => [sigpicdateline] => [sigpicwidth] => [sigpicheight] => [postcount] => 2 [islastshown] => [isfirstshown] => [attachments] => [allattachments] => ) --> data_registre 20031120231019 > --> data_ultima_connexio 20031120231019 > > ** UPDATE usuaris SET data_ultima_connexio = '20031120231112' WHERE userid = > 'test' > ** SELECT * FROM usuaris WHERE userid = 'test' > --> data_registre 20031120231112 > --> data_ultima_connexio 20031120231112 > > The PHP statements are exactly those that begin with **, and --> shows a > subset of a results received. > > > As you can see, the last update modifies both data_registre and > data_ultima_connexio. These updates and selects run alone and in sequential > mode, so data_registre should be always the same. > > I really don't figure where is the problem. Moreover I add the table definition. > > CREATE TABLE usuaris (userid VARCHAR(16), > nom_complet VARCHAR(64) NOT NULL, > correu VARCHAR(64) NOT NULL, > data_registre TIMESTAMP(14) NOT NULL, > data_ultima_connexio TIMESTAMP(14), > data_ultima_fallada TIMESTAMP(14), > paraula_de_pas VARCHAR(32) NOT NULL, > privilegis VARCHAR(255), > fallades INTEGER NOT NULL, > PRIMARY KEY (userid)); > > Has anyone any idea that could solve this problem? > > Thanks in advance. > > -- > ________________________________________________________________________ > Harald Servat Gelabert (harald at cepba dot upc dot es) > o//o Centre Europeu de Paral.lelisme de Barcelona CEPBA > o//o [url]WWW...:[/url] [url]http://www.cepba.upc.es[/url] Tel: +34-93-401 74 23 > o//o e-mail: [email]suport@cepba.upc.es[/email] Fax: +34-93-401 25 77 > o//o CEPBA c/Jordi Girona, 1-3, Ṃdul D6. E-08034 Barcelona, Catalunya > ________________________________________________________________________ > > The fundamental difference between Unix and Macintosh operating system > is that Unix was designed to please programmers, whereas the Mac was > designed to please users. (Windows, on the other hand, was designed to > please accountants, but that's another story) > -- from The UNIX haters handbook, page 163[/quote] [allowsmilie] => 1 [showsignature] => 0 [ipaddress] => [iconid] => 0 [visible] => 1 [attach] => 0 [infraction] => 0 [reportthreadid] => 0 [isusenetpost] => 1 [msgid] => [ref] => <3FBDE2E4.952EB49E@cepba.upc.es> [htmlstate] => on_nl2br [postusername] => Wes Bailey [ip] => wesley_bailey@y [isdeleted] => 0 [usergroupid] => [membergroupids] => [displaygroupid] => [password] => [passworddate] => [email] => [styleid] => [parentemail] => [homepage] => [icq] => [aim] => [yahoo] => [msn] => [skype] => [showvbcode] => [showbirthday] => [usertitle] => [customtitle] => [joindate] => [daysprune] => [lastvisit] => [lastactivity] => [lastpost] => [lastpostid] => [posts] => [reputation] => [reputationlevelid] => [timezoneoffset] => [pmpopup] => [avatarid] => [avatarrevision] => [profilepicrevision] => [sigpicrevision] => [options] => [akvbghsfs_optionsfield] => [birthday] => [birthday_search] => [maxposts] => [startofweek] => [referrerid] => [languageid] => [emailstamp] => [threadedmode] => [autosubscribe] => [pmtotal] => [pmunread] => [salt] => [ipoints] => [infractions] => [warnings] => [infractiongroupids] => [infractiongroupid] => [adminoptions] => [profilevisits] => [friendcount] => [friendreqcount] => [vmunreadcount] => [vmmoderatedcount] => [socgroupinvitecount] => [socgroupreqcount] => [pcunreadcount] => [pcmoderatedcount] => [gmmoderatedcount] => [assetposthash] => [fbuserid] => [fbjoindate] => [fbname] => [logintype] => [fbaccesstoken] => [newrepcount] => [vbseo_likes_in] => [vbseo_likes_out] => [vbseo_likes_unread] => [temp] => [field1] => [field2] => [field3] => [field4] => [field5] => [subfolders] => [pmfolders] => [buddylist] => [ignorelist] => [signature] => [searchprefs] => [rank] => [icontitle] => [iconpath] => [avatarpath] => [hascustomavatar] => 0 [avatardateline] => [avwidth] => [avheight] => [edit_userid] => [edit_username] => [edit_dateline] => [edit_reason] => [hashistory] => [pagetext_html] => [hasimages] => [signatureparsed] => [sighasimages] => [sigpic] => [sigpicdateline] => [sigpicwidth] => [sigpicheight] => [postcount] => 3 [islastshown] => 1 [isfirstshown] => [attachments] => [allattachments] => ) --> php & mysql update problem - PHP Development

php & mysql update problem - PHP Development

Dear news-team I'm using MySQL 4.0.15a (with PHP 4.3.4rc1 and Apache 2.0.47 under FreeBSD). I'm having problems when updating a column of a table (it updates an extra column). As an example, I provide this sample (data_registre, data_ultima_connexio are the outputs of the SELECT). ** UPDATE usuaris SET data_ultima_fallada = 'NULL' WHERE userid = 'test' ** SELECT * FROM usuaris WHERE userid = 'test' --> data_registre 20031120231019 --> data_ultima_connexio 20031120231019 ** UPDATE usuaris SET data_ultima_connexio = '20031120231112' WHERE userid = 'test' ** SELECT * FROM usuaris WHERE userid = 'test' --> data_registre 20031120231112 --> data_ultima_connexio 20031120231112 The PHP statements are ...

  1. #1

    Default php & mysql update problem

    Dear news-team

    I'm using MySQL 4.0.15a (with PHP 4.3.4rc1 and Apache 2.0.47 under FreeBSD).

    I'm having problems when updating a column of a table (it updates an extra
    column).

    As an example, I provide this sample (data_registre, data_ultima_connexio are
    the outputs of the SELECT).

    ** UPDATE usuaris SET data_ultima_fallada = 'NULL' WHERE userid = 'test'
    ** SELECT * FROM usuaris WHERE userid = 'test'
    --> data_registre 20031120231019
    --> data_ultima_connexio 20031120231019

    ** UPDATE usuaris SET data_ultima_connexio = '20031120231112' WHERE userid =
    'test'
    ** SELECT * FROM usuaris WHERE userid = 'test'
    --> data_registre 20031120231112
    --> data_ultima_connexio 20031120231112

    The PHP statements are exactly those that begin with **, and --> shows a
    subset of a results received.


    As you can see, the last update modifies both data_registre and
    data_ultima_connexio. These updates and selects run alone and in sequential
    mode, so data_registre should be always the same.

    I really don't figure where is the problem. Moreover I add the table definition.

    CREATE TABLE usuaris (userid VARCHAR(16),
    nom_complet VARCHAR(64) NOT NULL,
    correu VARCHAR(64) NOT NULL,
    data_registre TIMESTAMP(14) NOT NULL,
    data_ultima_connexio TIMESTAMP(14),
    data_ultima_fallada TIMESTAMP(14),
    paraula_de_pas VARCHAR(32) NOT NULL,
    privilegis VARCHAR(255),
    fallades INTEGER NOT NULL,
    PRIMARY KEY (userid));

    Has anyone any idea that could solve this problem?

    Thanks in advance.

    --
    __________________________________________________ ______________________
    Harald Servat Gelabert (harald at cepba dot upc dot es)
    o//o Centre Europeu de Paral.lelisme de Barcelona CEPBA
    o//o [url]WWW...:[/url] [url]http://www.cepba.upc.es[/url] Tel: +34-93-401 74 23
    o//o e-mail: [email]suportcepba.upc.es[/email] Fax: +34-93-401 25 77
    o//o CEPBA c/Jordi Girona, 1-3, Ṃdul D6. E-08034 Barcelona, Catalunya
    __________________________________________________ ______________________

    The fundamental difference between Unix and Macintosh operating system
    is that Unix was designed to please programmers, whereas the Mac was
    designed to please users. (Windows, on the other hand, was designed to
    please accountants, but that's another story)
    -- from The UNIX haters handbook, page 163
    Harald Servat Gelabert Guest

  2. #2

    Default Re: php & mysql update problem


    On 21-Nov-2003, Harald Servat Gelabert <haraldcepba.upc.es> wrote:
    > I'm using MySQL 4.0.15a (with PHP 4.3.4rc1 and Apache 2.0.47 under
    > FreeBSD).
    >
    > I'm having problems when updating a column of a table (it updates an extra
    > column).
    >
    > As an example, I provide this sample (data_registre, data_ultima_connexio
    > are
    > the outputs of the SELECT).
    >
    > ** UPDATE usuaris SET data_ultima_fallada = 'NULL' WHERE userid = 'test'
    > ** SELECT * FROM usuaris WHERE userid = 'test'
    > --> data_registre 20031120231019
    > --> data_ultima_connexio 20031120231019
    >
    > ** UPDATE usuaris SET data_ultima_connexio = '20031120231112' WHERE
    > userid =
    > 'test'
    > ** SELECT * FROM usuaris WHERE userid = 'test'
    > --> data_registre 20031120231112
    > --> data_ultima_connexio 20031120231112
    >
    > The PHP statements are exactly those that begin with **, and --> shows a
    > subset of a results received.
    >
    >
    > As you can see, the last update modifies both data_registre and
    > data_ultima_connexio. These updates and selects run alone and in
    > sequential
    > mode, so data_registre should be always the same.
    >
    > I really don't figure where is the problem. Moreover I add the table
    > definition.
    >
    > CREATE TABLE usuaris (userid VARCHAR(16),
    > nom_complet VARCHAR(64) NOT NULL,
    > correu VARCHAR(64) NOT NULL,
    > data_registre TIMESTAMP(14) NOT NULL,
    > data_ultima_connexio TIMESTAMP(14),
    > data_ultima_fallada TIMESTAMP(14),
    > paraula_de_pas VARCHAR(32) NOT NULL,
    > privilegis VARCHAR(255),
    > fallades INTEGER NOT NULL,
    > PRIMARY KEY (userid));
    >
    > Has anyone any idea that could solve this problem?
    TIMESTAMP columns are automatically updated whenever you modify the row.
    Change the TIMESTAMP columns to DATETIME.

    --
    Tom Thackrey
    [url]www.creative-light.com[/url]
    tom (at) creative (dash) light (dot) com
    do NOT send email to [email]jamesbutlerwillglen.net[/email] (it's reserved for spammers)
    Tom Thackrey Guest

  3. #3

    Default Re: php & mysql update problem

    Your problem is in the design of your database table. MySQL has the
    special property that the first column of TIMESTAMP datatype will
    automatically be updated when a record is changed with the UPDATE DML
    statement. My suggestion is to add a date_modified column before the
    data_registre column and you can choose to ignore but it will solve
    your problem.

    Wes
    > Harald Servat Gelabert <haraldcepba.upc.es> wrote in message news:
    > <3FBDE2E4.952EB49Ecepba.upc.es>...
    > Dear news-team
    >
    > I'm using MySQL 4.0.15a (with PHP 4.3.4rc1 and Apache 2.0.47 under FreeBSD).
    >
    > I'm having problems when updating a column of a table (it updates an extra
    > column).
    >
    > As an example, I provide this sample (data_registre, data_ultima_connexio are
    > the outputs of the SELECT).
    >
    > ** UPDATE usuaris SET data_ultima_fallada = 'NULL' WHERE userid = 'test'
    > ** SELECT * FROM usuaris WHERE userid = 'test'
    > --> data_registre 20031120231019
    > --> data_ultima_connexio 20031120231019
    >
    > ** UPDATE usuaris SET data_ultima_connexio = '20031120231112' WHERE userid =
    > 'test'
    > ** SELECT * FROM usuaris WHERE userid = 'test'
    > --> data_registre 20031120231112
    > --> data_ultima_connexio 20031120231112
    >
    > The PHP statements are exactly those that begin with **, and --> shows a
    > subset of a results received.
    >
    >
    > As you can see, the last update modifies both data_registre and
    > data_ultima_connexio. These updates and selects run alone and in sequential
    > mode, so data_registre should be always the same.
    >
    > I really don't figure where is the problem. Moreover I add the table definition.
    >
    > CREATE TABLE usuaris (userid VARCHAR(16),
    > nom_complet VARCHAR(64) NOT NULL,
    > correu VARCHAR(64) NOT NULL,
    > data_registre TIMESTAMP(14) NOT NULL,
    > data_ultima_connexio TIMESTAMP(14),
    > data_ultima_fallada TIMESTAMP(14),
    > paraula_de_pas VARCHAR(32) NOT NULL,
    > privilegis VARCHAR(255),
    > fallades INTEGER NOT NULL,
    > PRIMARY KEY (userid));
    >
    > Has anyone any idea that could solve this problem?
    >
    > Thanks in advance.
    >
    > --
    > __________________________________________________ ______________________
    > Harald Servat Gelabert (harald at cepba dot upc dot es)
    > o//o Centre Europeu de Paral.lelisme de Barcelona CEPBA
    > o//o [url]WWW...:[/url] [url]http://www.cepba.upc.es[/url] Tel: +34-93-401 74 23
    > o//o e-mail: [email]suportcepba.upc.es[/email] Fax: +34-93-401 25 77
    > o//o CEPBA c/Jordi Girona, 1-3, Ṃdul D6. E-08034 Barcelona, Catalunya
    > __________________________________________________ ______________________
    >
    > The fundamental difference between Unix and Macintosh operating system
    > is that Unix was designed to please programmers, whereas the Mac was
    > designed to please users. (Windows, on the other hand, was designed to
    > please accountants, but that's another story)
    > -- from The UNIX haters handbook, page 163
    Wes Bailey Guest

Similar Threads

  1. Replies: 0
    Last Post: September 9th, 12:54 AM
  2. MySql UPDATE problem with duplicate rows
    By Jon Maz in forum MySQL
    Replies: 7
    Last Post: May 17th, 09:30 AM
  3. flash > php > mySQL update query problem
    By kidfunctional in forum Macromedia Flash Data Integration
    Replies: 1
    Last Post: April 20th, 03:39 PM
  4. Replies: 2
    Last Post: January 24th, 04:19 PM
  5. Flash - PHP - mySQL - update databse records problem
    By ++Barry++ in forum Adobe Flash, Flex & Director
    Replies: 7
    Last Post: June 1st, 08:36 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139