Tuesday, December 3, 2013

How to select database in command line?

How to select database in command line?
USE DATABASE_NAME
mysq> use tesing

How to show table engine in mysql command line ?

SHOW TABLE STATUS WHERE Name = 'table_name'

why use magic method __toString() if php return varibale data type?

here is the error message ... must return a string value ... just means the return value of __toString() has to be a value of data type string. If $users_class in your example is not intended to be a string value, it has be to converted to a string before returning it.
But when reading the above example, it seems to me that the var $users_class may just not have been initialized yet. In this case change the method __toString() to :
public function __toString() {
    if(is_null($this->users_class)) {
        return 'NULL';
    }
    return $this->user_class;
}
To make the above code working, you'll need to make a change in the smarty code too. Remove the double quotes around the value of the value= attribute.