Mysql erratic output

Hi,this doesnt give any output

mysql -uroot -phruti2 -B -e "use WebNmsDB;select HEADERINDEX from meas_headers where CLLI= '$clli' and IVALSTART>'$ivalstart' and IVALSTART<'$ivalend' and RPTTYPE='$rpttype';" > asdf.txt

This generates "good" output

mysql -uroot -phruti2 -B -e "use WebNmsDB;select HEADERINDEX from meas_headers where CLLI='tklc9010801' and IVALSTART>='01:30:00' and IVALSTART<'02:00:00' and RPTTYPE='COMPONENT MEASUREMENTS ON LINK';" > win.txt

Why so ???

the outputs of

echo $ivalstart
echo $ivalend
echo $clli
echo $rpttype

respectively are

01:30:00
02:00:00
tklc9010801
COMPONENT MEASUREMENTS ON LINK

PLease run your command with the shell's xtrace option set and post the output.