shaddf Posted March 19, 2017 Share Posted March 19, 2017 i have this sql query result: +--------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------+---------------+------+-----+---------+-------+ | Gender | enum('M','F') | YES | | NULL | | +--------+---------------+------+-----+---------+-------+ 1 row in set (0.00 sec) how can i loaad the enum type field into a select.I have tried this but it shows nothing $this->mGender = Cag::GetGender(); and in php script: echo $obj->mGender['Type']; Quote Link to comment Share on other sites More sharing options...
thinsoldier Posted March 19, 2017 Share Posted March 19, 2017 var_dump( $obj->mGender['Type'] ); to find out what kind of value it holds. I assume it will be the literal string "enum('M','F')". If so you'll have to do some string replacing and exploding to get an array of just ['M','F']. You could just hard code M and F <options> and save yourself the trouble. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.