Hi guys!
Im struggling with little bit complicated sql query:
public function isInHaplotype ('phenotype','10', $rs_ID_needle,'In Panel') {
$getHaplotypes = $ghcCore->table('haplotypes')->select('id',
'rs_id_1',
'rs_id_2',
'rs_id_3',
'rs_id_4',
'rs_id_5',
'risk_allele',
'odds_ratio')
->where($cond,$id)->where('status',$status)
->where(function($query){
$query->where('rs_id_1',$rs_ID_needle);
//->orWhere('rs_id_2',$rs_ID_needle)
//->orWhere('rs_id_3',$rs_ID_needle)
//->orWhere('rs_id_4',$rs_ID_needle)
//->orWhere('rs_id_5',$rs_ID_needle);
})
->count();
When I run this query I get:
"Undefined variable: rs_ID_needle"
Meaning I can not pass the function parametr $rs_ID_needle to the query.
When I hard code the parametr the query starts to work just fine.
So basically I need to pass the variable to this part of the code:
->where(function($query){
$query->where('rs_id_1',$rs_ID_needle);
And thats what does not work and I get "Undefined variable: rs_ID_needle"