我看到很多关于使用 MySQL 和存储过程的首字母大写的帖子。我都试过了,但没有一个对我有用。下面是我尝试过的代码..
计划控制器.php
$companies = $this->Plan->Company->find('list', array('conditions' => array('Company.status' => 'active'), 'fields' => array('Company.id','CONCAT(UCASE(LEFT(Company.name, 1)),SUBSTRING(Company.name, 2)) as name'))); //Getting Empty Dropdown
$companies = $this->Plan->Company->find('list', array('conditions' => array('Company.status' => 'active'), 'fields' => array('Company.id', 'UCASE(Company.name)'))); //Getting Empty Dropdown
$companies = $this->Plan->Company->find('list', array('conditions' => array('Company.status' => 'active'), 'fields' => array('Company.id', 'Company.name'))); //Getting Dropdown in view
看法
<select name="data[Plan][company_id]" class="" id="PlanCompanyId">
<option value="">Please Select</option>
<option value="2">xyz abc</option>
<option value="1">lmd abc</option>
<option value="13">Abc ey</option>
<option value="12">sys abc</option>
</select>
期望输出:
<select name="data[Plan][company_id]" class="" id="PlanCompanyId">
<option value="">Please Select</option>
<option value="2">Xyz Abc</option>
<option value="1">Lmd Abc</option>
<option value="13">Abc Ey</option>
<option value="12">Sys Abc</option>
</select>
如何将下拉列表的第一个字母大写?