I searched for anti sql-injection code. Folloing code is what i adopted. I want to re-confirm that following php code can prevent sql-injection
$sql_select = "
SELECT
*
FROM main_tbl
WHERE
(
(((main_tbl.from_id = :sender_id) AND (main_tbl.to_id = :to_id))
OR ((main_tbl.to_id = :sender_id) AND (main_tbl.from_id = :to_id)))
AND
(main_tbl.last_date > :lasttime)
);
";
$binds = array(
'sender_id' => $sender_id,
'to_id' => $to_id,
'sender_id' => $sender_id,
'to_id' => $to_id,
'lasttime' => $lasttime
);
$resource = Mage::getModel('core/resource');
$read = $resource->getConnection('core_read');
$results = $read->fetchAll($sql_select, $binds);