Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: PHP
Posted by: david Panter
Added: Dec 5, 2019 3:07 PM
Views: 135
Tags: no tags
  1. //Get the first two characters using substr.
  2. $firstThreeCharacters = substr($record['mawb'], 0, 3);
  3. // load record from 'awb_prefix'
  4.   list($awb_prefixRecords, $awb_prefixMetaData) = getRecords(array(
  5.     'tableName'   => 'awb_prefix',
  6.     'where'       => "`3code` = '$firstThreeCharacters'",
  7.     'loadUploads' => true,
  8.     'allowSearch' => false,
  9.     'limit'       => '1',
  10.   ));
  11.   $awb_prefixRecord = @$awb_prefixRecords[0]; // get first record
  12.   if (!$awb_prefixRecord) { dieWith404("Record not found!"); } // show error message if no record found