get_field function

get_field function

ដោយ Ângelo Rigo នៅ
ចំនួនតប៖ 1

Hi

How is it done if i need to aply a postgresql function inside a get_field function call like: substr(idnumber,1,8)

The line below return a error message saying :Field "substring(idnumber,1,8)" does not exist in table "course" 

$something = $DB->get_field('course','fullname',array('substring(idnumber,1,8)'=>$data->something));

What i nee is to compare a substring of the collum with a especific value.


Thankś in advance

មធ្យមភាគនៃរង្វាយតម្លៃ: -
ឆ្លើយតបទៅកាន់ Ângelo Rigo

Re: get_field function

ដោយ Hubert Chathi នៅ

You will need to use get_field_select or get_field_sql for more complicated queries such as what you are trying to do.

មធ្យមភាគនៃរង្វាយតម្លៃ: -