get_field function

get_field function

par Ângelo Rigo,
Nombre de réponses : 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

Moyenne des évaluations  -
En réponse à Ângelo Rigo

Re: get_field function

par 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.