How to check order exist or not in commerce order? I am using Drupal 7.31 and the Commerce Kickstart distribution. I added an order using CSV file in commerce_payment_transaction table.

I want to check the condition below:

if (isset($_POST['submit'])) {
  $handle = fopen($_FILES['filename']['tmp_name'], "r");    

  $i = 1;
  $f_status = FALSE;
  while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
      if($i &gt; 2){

        $o_id = $data[1]; // I am fetch order_id from csv. I wont to check which order_id is coming from csv is present on commerce_order or not?                   
        $remote_id = $data[2];
        $created = strtotime($data[7]);
        $changed = strtotime($data[11]);
        $amount = $data[8] * 100;

        $db_query = db_select('commerce_payment_transaction','cpt');
        $db_query-&gt;fields('cpt');
        $db_query-&gt;condition('cpt.order_id',$o_id,'=');
        $db_res = $db_query-&gt;execute();
        $row_count = $db_res-&gt;rowCount();

        if($row_count == 0){
            $o_load = commerce_order_load($o_id);
        }
    }
  }
}else{
   $output = "Upload new csv by browsing to file and clicking on Upload&lt;br /&gt;\n";
   $output .= "&lt;form enctype='multipart/form-data' method='post'&gt;";
   $output .= "File name to import:&lt;br /&gt;\n";
   $output .= "&lt;input size='50' type='file' name='filename'&gt;&lt;br /&gt;\n";
   $output .= "&lt;input type='submit' name='submit' value='Upload CSV'&gt;&lt;/form&gt;";
   return $output;
 }
 $i++;
}


How can I do so?
You can check this using commerce_order_load()

if(commerce_order_load($order_id)){
    //Do something
}
else{
   //Do something
}


Hope this will help you