473,668 Members | 2,371 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_con nexio are
the outputs of the SELECT).

** UPDATE usuaris SET data_ultima_fal lada = 'NULL' WHERE userid = 'test'
** SELECT * FROM usuaris WHERE userid = 'test'
--> data_registre 20031120231019
--> data_ultima_con nexio 20031120231019

** UPDATE usuaris SET data_ultima_con nexio = '20031120231112 ' WHERE userid =
'test'
** SELECT * FROM usuaris WHERE userid = 'test'
--> data_registre 20031120231112
--> data_ultima_con nexio 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_con nexio. 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_con nexio TIMESTAMP(14),
data_ultima_fal lada 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 WWW...: http://www.cepba.upc.es Tel: +34-93-401 74 23
o//o e-mail: su****@cepba.up c.es Fax: +34-93-401 25 77
o//o CEPBA c/Jordi Girona, 1-3, Mò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
Jul 17 '05 #1
2 7150

On 21-Nov-2003, Harald Servat Gelabert <ha****@cepba.u pc.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_con nexio
are
the outputs of the SELECT).

** UPDATE usuaris SET data_ultima_fal lada = 'NULL' WHERE userid = 'test'
** SELECT * FROM usuaris WHERE userid = 'test'
--> data_registre 20031120231019
--> data_ultima_con nexio 20031120231019

** UPDATE usuaris SET data_ultima_con nexio = '20031120231112 ' WHERE
userid =
'test'
** SELECT * FROM usuaris WHERE userid = 'test'
--> data_registre 20031120231112
--> data_ultima_con nexio 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_con nexio. 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_con nexio TIMESTAMP(14),
data_ultima_fal lada 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
www.creative-light.com
tom (at) creative (dash) light (dot) com
do NOT send email to ja*********@wil lglen.net (it's reserved for spammers)
Jul 17 '05 #2
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 <ha****@cepba.u pc.es> wrote in message news:
<3F************ ***@cepba.upc.e s>...
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_con nexio are
the outputs of the SELECT).

** UPDATE usuaris SET data_ultima_fal lada = 'NULL' WHERE userid = 'test'
** SELECT * FROM usuaris WHERE userid = 'test'
--> data_registre 20031120231019
--> data_ultima_con nexio 20031120231019

** UPDATE usuaris SET data_ultima_con nexio = '20031120231112 ' WHERE userid =
'test'
** SELECT * FROM usuaris WHERE userid = 'test'
--> data_registre 20031120231112
--> data_ultima_con nexio 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_con nexio. 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_con nexio TIMESTAMP(14),
data_ultima_fal lada 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 WWW...: http://www.cepba.upc.es Tel: +34-93-401 74 23
o//o e-mail: su****@cepba.up c.es Fax: +34-93-401 25 77
o//o CEPBA c/Jordi Girona, 1-3, Mò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

Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
3700
by: John Victor | last post by:
In my mysql database, I've stored all the passwords using the PASSWORD() function. Now I'm running a test and need to compare the password in my php document to that saved in the database. I used the string "Select name From users Where password = PASSWORD('$testPass')" and ran mysql_query() using the string. But nothing was returned. So I decided to run a test and try to change a password from my php page using the string
2
2842
by: Atz | last post by:
Hi to all ! Im using MySql front and PHP 5 for some web shop. I didn't try it so far but i guess that the online data insertation ( accept costs and time ) should be the same process like for local connection. Problem: I have to create online ( on remote server ) some 6 tables and some 20 fields with MySql front. Ok. This shouldn't be great problem ( i hope :-)).
0
5659
by: aars | last post by:
Hello all, I am creating a user administration system where system administrator can activate services for a user, like webspace, a mail account or a subdomain. I now want to create a function that creates mysql databases and grant the right privileges to a user. But the problem is that mysql wants to have the plaintext password for the user in the "grant ... identified by 'pwd'" field, or in a manual query to update the password in...
4
2799
by: MLH | last post by:
A programmer developed an AMP (Apache/MySQL/PHP) application for me. When he was done, he sent me the PHP files and the MySQL dump file. Now, when I connect to the application on my LAN using http://192.168.1.106/~mlh/credifree/index.php the AMP app still thinks the data resides somewhere else. It runs fine - as long as I leave my LAN's external internet connection up. But if I unplug my LAN from the world, my app locks up. Before I...
5
2041
by: princevejita1 | last post by:
Hello I have problem with my MySQL server and transactions. I installed MySQL server 5.0.11 with MySQL administrator & MySql Query Browser on Win XP Prof. I would like to use transactions, so I have read the manual ana I thought I knew how to do it. I set the tables type to InnoDB (i can't use BDB) and change the default mysqld.exe to mysql-max (or mysql-max-nt). I even used : SET AUTOCOMMIT=0. I'm doing more less this: 1. START...
10
2790
by: Bob Hollness | last post by:
AAARRRGHHH!!! I fix my server, well, I rebuilt it actually. It runs Suse 9.2 and MySQL 4.0.21 When I try to do a Recordset.Update I get the following error. Error Number = -2147217871 Error Message = Can't create TCP/IP socket (10093)
1
2437
by: gordon.dtr | last post by:
Hi, Has anyone had this problem ? I am using MySQL ODBC 3.51 Driver, with MS Access 2003 and MySQL 4.1.11 standard log. I created my tables in MS Access, then exported them via ODBC to an externally hosted MySQL database (fasthosts) . I then import-linked
0
5558
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted ******************************************************** For this teeny job, please refer to: http://feeds.reddit.com/feed/8fu/?o=25
3
4360
by: Ludwig Wittgenstein | last post by:
Hello, all. Does anyone know of documentation about implementing a publish- subscribe model between a .NET Web service provide and a Java service consumer? I have this problem I am trying to solve, and would greatly appreciate it if someone can tell me what the best solution would be for it. I have a .NET 2.0 (ASMX) webservice on a server on a dedicated hosting server, and several clients in different cities running linux servers
0
8459
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8374
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8890
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8791
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8575
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6206
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4373
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2784
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1783
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.