retrive data from drupal not working What I tried

    $sql="select * from project_status where node_id=".$vid." and ".  strtolower($field_progress_flags)."!='' and ".  strtolower($field_progress_flags)." IS NOT NULL";    
    $query=$sql;
    $array = array();
    $result = mysql_query($query);
    while ($object = mysql_fetch_array($result)) {
        $array[] = $object;
    }
    mysql_freeresult($result);
    echo "&lt;pre&gt;";
    print_r($array);


the actual sql query is  select * from project_status where node_id=385 and draft!='' and draft IS NOT NULL

here am not getting any data
what am doing wrong here?
After some R&amp;D got the solution as follows:

$sql="select * from project_status where node_id=".$vid." and ".  strtolower($field_progress_flags)."!='' and ".  strtolower($field_progress_flags)." IS NOT NULL";    
$result = db_query($sql);
while($record = $result-&gt;fetchAssoc()){
        $data[]=$record;
}  


and its works for me