'Returning data from or sql statement

Am retrieving data from a database using json

CODE:

The values of ($id_from= 1 and  $id_to= 4)

The sql statement is

$sql ="SELECT * FROM {$this->_table} WHERE comm ='$idfrom$idto' or comm ='$idto$idfrom'  ";  

This returns no results

But when i do :

$sql ="SELECT * FROM {$this->_table} WHERE comm =14 or comm =41  ";

It returns all results

My database
enter image description here

Where could i be making a mistake in the first sql statement



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source