php - Getting the last updated value from mysql table -
hey guys have new mysql development ....i have table setup ..i need homecoming lastly updated value in mysql.
so have researched more , got solution create trigger purpose..
so code looks like
create table customers( id int not null auto_increment , name varchar (20) not null, age int not null, address char (25) , salary decimal (18, 2), primary key (id) ); insert customers (id,name,age,address,salary) values (1,'aff',2,3,5), (2,'lolyeah',9,13,15);
the trigger looks like
create trigger getrandom after update on customers each row begin update customers set name = 'somerange' address = 3; select name end;
the above trigger didnt works actually..
what need when update column customers need homecoming latest update value.
hope guys can help me..thanx
create column date_modified (date) input date when new client added or updated select * customers order date_modified
code {
sql:
create table customers( id int not null auto_increment , name varchar (20) not null, age int not null, address char (25) , salary decimal (18, 2), date_modified date, primary key (id) ); insert customers (id,name,age,address,salary,date_modified) values (1,'aff',2,3,5,'2012-11-10'), (2,'lolyeah',9,13,15,'2014-11-10'); select * customers order date_modified asc limit 1;
sql no id:
create table customers( id int not null auto_increment , name varchar (20) not null, age int not null, address char (25) , salary decimal (18, 2), date_modified date, primary key (id) ); insert customers (,name,age,address,salary,date_modified) values ('aff',2,3,5,'2012-11-10'), ('lolyeah',9,13,15,'2014-11-10'); select * customers order date_modified asc limit 1;
}
php mysql
No comments:
Post a Comment