pdo - how can I add a value to the current with SQL UPDATE -


i creating access log on website, whenever person entering site, set date , time whenever in same registry in database. however, instead of deleting last visit, added other. exemple:

this current value: 2014-01-31 17:18:27

this new value: 2014-02-01 17:18:27

if use update method, replace current value new. , stay follows: 2014-01-31 17:18:27, 2014-02-01 17:18:27

let's little closer i'm doing.

this function i'm creating:

function functionind() {     $this = 'this';     $conn = db();     $prepare = $conn->prepare('     update table     set dates=:date     this=:this');     $prepare->bindparam(':date',date("y-m-d h:i:s"));     $prepare->bindparam(':this', $this, pdo::param_str);     $prepare->execute();     disconnectbase($conn); } 

what need do?

you don't want this. storing lists in sql not right approach using database. need table stores dates in separate table, 1 row per this per date. if had such table, code easy:

insert thisdatetable(this, date)     select :this, :date; 

that said, if still insist on storing lists in field -- , subsequent delays , problems cause -- syntax 1 of following:

set date = concat(date, ',' :date)  set date = date || ',' || :date  set date = date + ',' + :date  set date = date & "," & :date 

the first uses ansi-standard function , supported mysql, oracle, sql server 2012, postgres, db2, , teradata (and perhaps others).

the second uses ansi-standard operator , supported several databases, notably oracle , postgres (and others).

the third "t-sql" format, , used sql server (all versions) , sybase.

the fourth used access , highly non-standard, both in use of & , use of " delimit strings.


Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -