Link to home
Start Free TrialLog in
Avatar of rgb192
rgb192Flag for United States of America

asked on

php pdo insert again if row columns are different

Some sort of id,
Timestamp
First name,
Last name,
Email
Weight

User may change any column
Want timestamp recorded if any column altered





User may change first
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

If any column is altered the TIMESTAMP column will be altered.  If there are no changes to the row, the TIMESTAMP column will not be altered. That is expected MySQL behavior.

It follows that if you create an UPDATE query that tries to UPDATE a row with column "weight" = 150 and the row already had column "weight" = 150, no update will occur.  I have never tested this, but I expect that you could experiment with a DATETIME column to cause an update to occur every time.  Just a thought, ~Ray
Avatar of rgb192

ASKER

I literally want to 'insert again' if results are different

for example if user changes their weight (int) or email (varchar)  then they get another row.


This is not an update.
ASKER CERTIFIED SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rgb192

ASKER

This would insert into the needed first row every time.
Thanks for the points and thanks for using EE, ~Ray