object-oriented/blog-cms (bckp)/class/database/dao/UserDAO.php
/**
    * Method: update
    *
    * Updates user data in the database.
    *
    * @param array of Column $columns: name and values of columns to be updated.
    * @param array of Column $where: name and values of columns used as conditions in WHERE clause.
    * @return false.
    *
    * Last Modified: Mar 18, 2019.
    */
update
Updates user data in the database.

@param array of Column $columns: name and values of columns to be updated.
@param array of Column $where: name and values of columns used as conditions in WHERE clause.
@return false.


update Updates user data in the database . @param array of Column $columns : name and values of columns to be updated . @param array of Column $where : name and values of columns used as conditions in WHERE clause . @return false .
public function update($columns, $where)
    {
        $cols = "";
        foreach ($columns as $c) {
            $cols .= QT_A . $c->getName() . QT_A . " = " . QT . $c->getValue() . QT . COMMA;
        }
        $cols = substr($cols, 0, - strlen(COMMA));
        $condition = "";
        foreach ($where as $c) {
            $condition .= QT_A . $c->getName() . QT_A . " = " . QT . $c->getValue() . QT . COMMA;
        }
        $condition = substr($condition, 0, - strlen(COMMA));
        $sql = "UPDATE " . QT_A . $this->tableName . QT_A . " SET {$cols} WHERE {$condition}";
        $res = $this->query($sql);
    }
public function update ( $ columns , $ where ) { $ cols = " " ; foreach ( $ columns as $ c ) { $ cols .= QT_A . $ c -> getName ( ) . QT_A . "  =  " . QT . $ c -> getValue ( ) . QT . COMMA ; } $ cols = substr ( $ cols , 0 , - strlen ( COMMA ) ) ; $ condition = " " ; foreach ( $ where as $ c ) { $ condition .= QT_A . $ c -> getName ( ) . QT_A . "  =  " . QT . $ c -> getValue ( ) . QT . COMMA ; } $ condition = substr ( $ condition , 0 , - strlen ( COMMA ) ) ; $ sql = " UPDATE  " . QT_A . $ this -> tableName . QT_A . "  SET  { $ cols }  WHERE  { $ condition } " ; $ res = $ this -> query ( $ sql ) ; }
Method: update
 Updates user data in the database.
Method : update Updates user data in the database .
#echo $cols; die(); #echo $condition; die(); #echo $sql; die();