php - Update row with data from another row in different tables -
i new mysql , not sure how can update row table while checking if logged in user same:
telefonist='".$_session["username"]."
and need check if date same gets right person on right date in row:
log.datum=telefonisti_podaci.datum
here trying count 1s , enter sum table1 table2 in specific place.
code:
$sql_zapis_do30 = "update telefonisti_podaci set `total tura 30` = (select count(*) `ture 30` log,telefonisti_podaci `ture 30` not null , `ture 30`=1 , log.datum=telefonisti_podaci.datum ) `telefonist`='".$_session["username"]."'"; customquery($sql_zapis_do30);
i error:
you can't specify target table 'telefonisti_podaci' update in clause
thanks
i have solved this:
$sql_zapis_do30 = "update telefonisti_podaci set `total tura 30` = (select count(`ture 30`) log `telefonist`='".$_session["username"]."' , `ture 30`=1 , `datum`='".$datum_danas."') `telefonist`='".$_session["username"]."' , `datum`='".$datum_danas."'";
and works thanks
Comments
Post a Comment