-1

I've managed to have a working code with this

if ($kurs){
            $search_str .= $search_str ? ' AND ': 'WHERE' ;
            $search_str .= "`tblalumni`.`course` LIKE '%" .$kurs."%' "; 
        }

As you can see it's just have one variable, I would like to have a SQL BETWEEN Operator within two variable

here it is but it is not working

if ($year1)AND($year2){
            $search_str .= $search_str ? ' AND ': 'WHERE' ;
            $search_str .= "`tblalumni`.`yeargrad` BETWEEN '%" .$year1."%' AND '%" .$year2."%' "; 
        }

This is the error

Parse error: syntax error, unexpected 'AND' (T_LOGICAL_AND) in C:\xampp\htdocs\new1v2\admin\alumni_search_list.php on line 40

Please help me T_T

lokis
  • 67
  • 8

1 Answers1

0
if ($year1 && $year2) {
            $search_str .= $search_str ? ' AND ': 'WHERE' ;
            $search_str .= "`tblalumni`.`yeargrad` BETWEEN '%" .$year1."%' AND '%" .$year2."%' "; 
        }

Try this sorry i could't comment

marlonjd
  • 135
  • 10