正确使用mysql查询

i have a table called messages that has the following columns with the following sample data

id  m_id  from  to   message
1   1     him   her  hellow
2   1     her   him  what sup
3   1     him   her  nothing

and in the session the last message was sent to "her". How in sql can i select where from or to are not her? I tried this code but dont know if its correct

$b would be m_id number 1

$result = $mysqli->query('SELECT * FROM mensajes WHERE m_id  = \''.$b.'\' and from,to != \''.$_session['her'].'\' ');

UPDATE this code is to find the other user that is not 'her'

i solved using this query

$resulto = $mysqli->query('SELECT * FROM mensajes WHERE m_id  = \''.$b.'\' AND (from != \''.$usr.'\' OR to != \''.$usr.'\') ');

$usr is in this case her and $b is m_id number 1

so to take him im using:

if($resultad['from'] != $usr){
                 $seo .= '<input type="hidden" class="input-block-level" value="'.$resultad['from'].'" id="from" name="from">';
                }elseif($resultad['to'] != $usr){
                 $seo .= '<input type="hidden" class="input-block-level" value="'.$resultad['to'].'" id="from" name="from">';
                }