mysql custom global defined variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In my database design, I tend to store some variable that is meant to be acting as a ROLE or TYPE as SMALLINT. For example : 

    CREATE TABLE `house` (
       `id` int(11) NOT NULL AUTO_INCREMENT,
       `type` smallint(11) NOT NULL,
    )


And in php, I do

    define('HOUSE_SMALL_TYPE', '0');
    define('HOUSE_MEDIUM_TYPE', '1');

So in php, in SELECT queries I do :

    $this->db->query("SELECT * FROM house  
                        WHERE type=?;", HOUSE_SMALL_TYPE);

My questions are : 
1. In the php part, is there is a better way to do this ? 
2. In the mysql itself, does mysql also has global define functionality (like the define in php) ? I also want to do kind of SELECT * FROM house WHERE type = HOUSE_SMALL_TYPE in mysql query.


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux