function sql_crear($cTipo, $cTabla, $cWhere = "") { $cTipo = strtoUpper("{$cTipo}"); if ($cTipo == "INSERT") { $aReg = array("tipo" => "INSERT", "tabla" => $cTabla, "campos" => "", "values" => ""); } else { $aReg = array("tipo" => "UPDATE", "tabla" => $cTabla, "set" => "", "where" => "{$cWhere}"); } return $aReg; }
/** * Initialisiert das globale SubpartArray und entfernt alle Subpartmarker. */ private function createSubpartArray($pbMarker) { $ret = array(); foreach ($this->pagePartsDef as $part) { $ret['###' . $pbMarker . '_' . strtoUpper($part) . '_PAGE###'] = ''; } return $ret; }
function add_department() { if (isset($_POST['submit'])) { $name = mysql_real_escape_string($_POST['name']); $name = ucwords($name); $abbrev = mysql_real_escape_string($_POST['abbrev']); $abbrev = strtoUpper($abbrev); if ($abbrev == "" || $name == "") { $this->set('missing', true); } else { $this->Admin->query("INSERT INTO Department (abbreviation,name) VALUES (\"{$abbrev}\",\"{$name}\")"); $this->set('added', true); } } }
if ($getal == 3) { $dagVanDeWeek = "woensdag"; } if ($getal == 4) { $dagVanDeWeek = "donderdag"; } if ($getal == 5) { $dagVanDeWeek = "vrijdag"; } if ($getal == 6) { $dagVanDeWeek = "zaterdag"; } if ($getal == 7) { $dagVanDeWeek = "zondag"; } $dagVanDeWeekCapitalized = strtoUpper($dagVanDeWeek); $positieLaatsteLetterA = strrpos($dagVanDeWeekCapitalized, 'A'); $dagVanDeWeekCapitalized[$positieLaatsteLetterA] = 'a'; ?> <!DOCTYPE html> <html> <head> <title>Opdracht conditional statements if</title> </head> <body> <h1>Opdracht conditional statements if</h1> <h2>Deel 2</h2> <p>Woord: <?php
/** * @param FormBuilderInterface $builder * @param array $options */ public function buildForm(FormBuilderInterface $builder, array $options) { $builder->add('firstname')->add('lastname')->add('birthDate', DateType::class, ['widget' => 'single_text', 'format' => 'dd-MM-yyyy', 'attr' => ['class' => 'form-control input-inline datepicker', 'data-provide' => 'datepicker', 'data-date-format' => 'dd-mm-yyyy']])->add('email', EmailType::class)->add('telephone')->add('webSite')->add('status', ChoiceType::class, array('choices' => array('Choisissez votre status' => null, 'Particulier' => '1', 'Professionnel' => '2'), 'choices_as_values' => true))->add('city', EntityType::class, array('class' => 'AppBundle:City', 'choice_label' => 'name'))->add('firm', EntityType::class, array('class' => 'AppBundle:Firm', 'choice_label' => function ($firm) { return strtoUpper($firm->getName()); })); }
/** * @abstract 添加文件简号 * @return null */ public function saveAction() { // 返回值数组 $result = array('success' => true, 'saveOrNot' => true, 'info' => '提交成功'); $request = $this->getRequest()->getParams(); $now = date('Y-m-d H:i:s'); $user_session = new Zend_Session_Namespace('user'); $user = $user_session->user_info['employee_id']; $val = (object) $request; $type = new Dcc_Model_Type(); if (isset($val->id) && $val->id) { // 编辑 // 检查是否文件简号已经存在 if ($type->fetchAll("id != " . $val->id . " and code = '" . $val->code . "'")->count() > 0) { $result['result'] = false; $result['info'] = "文件简号“" . $val->code . "”已经存在"; echo Zend_Json::encode($result); exit; } // 启用状态和自动编码设置 $data = array('resp_emp_id' => str_replace('E', '', $val->resp_emp_id), 'resp_dept_id' => str_replace('D', '', $val->resp_dept_id), 'grant_dept_id' => str_replace('D', '', $val->grant_dept_id), 'template' => $val->template, 'filerequire' => isset($val->filerequire) ? 1 : 0, 'secretlevel' => $val->secretlevel, 'code' => $val->code, 'name' => $val->name, 'category' => $val->category, 'duration' => $val->duration, 'fullname' => $val->fullname, 'length' => $val->length, 'description' => $val->description, 'remark' => $val->remark, 'state' => isset($val->state) ? 1 : 0, 'autocode' => isset($val->autocode) ? 1 : 0, 'modelrequire' => isset($val->modelrequire) ? 1 : 0, 'autotype' => $val->auto_id, 'model_id' => $val->model_id, 'flow_flg' => isset($val->flow_flg) ? 1 : 0, 'flow_id' => isset($val->flow_flg) ? $val->flow_id : 0, 'dev_model_id' => $val->dev_model_id, 'dev_flow_id' => isset($val->flow_flg) ? $val->dev_flow_id : 0, 'apply_flow_id' => isset($val->apply_flow_id) ? $val->apply_flow_id : 0, 'update_time' => $now, 'update_user' => $user); $where = "id = " . $val->id; try { $type->update($data, $where); } catch (Exception $e) { $result['result'] = false; $result['info'] = $e->getMessage(); echo Zend_Json::encode($result); exit; } } else { // 检查是否文件简号已经存在 if ($type->fetchAll("code = '" . $val->code . "'")->count() > 0) { $result['result'] = false; $result['saveOrNot'] = false; $result['info'] = "文件简号“" . $val->code . "”已经存在"; echo Zend_Json::encode($result); exit; } $data = array('resp_emp_id' => str_replace('E', '', $val->resp_emp_id), 'resp_dept_id' => str_replace('D', '', $val->resp_dept_id), 'grant_dept_id' => str_replace('D', '', $val->grant_dept_id), 'template' => $val->template, 'filerequire' => isset($val->filerequire) ? 1 : 0, 'secretlevel' => $val->secretlevel, 'code' => strtoUpper($val->code), 'name' => $val->name, 'category' => $val->category, 'duration' => $val->duration, 'fullname' => $val->fullname, 'length' => $val->length, 'description' => $val->description, 'remark' => $val->remark, 'state' => isset($val->state) ? 1 : 0, 'autocode' => isset($val->autocode) ? 1 : 0, 'modelrequire' => isset($val->modelrequire) ? 1 : 0, 'autotype' => $val->auto_id, 'model_id' => $val->model_id, 'flow_flg' => isset($val->flow_flg) ? 1 : 0, 'flow_id' => isset($val->flow_flg) ? $val->flow_id : 0, 'dev_model_id' => $val->dev_model_id, 'dev_flow_id' => isset($val->flow_flg) ? $val->dev_flow_id : 0, 'apply_flow_id' => isset($val->apply_flow_id) ? $val->apply_flow_id : 0, 'create_time' => $now, 'create_user' => $user, 'update_time' => $now, 'update_user' => $user); try { $type->insert($data); } catch (Exception $e) { $result['result'] = false; $result['info'] = $e->getMessage(); echo Zend_Json::encode($result); exit; } } echo Zend_Json::encode($result); exit; }
$querys = "SELECT F.*,I.*,S.code,C.CLIENT_EMAIL,Z.box_type FROM FACTURAS F, ITEMS_FACTURA I, STATES S, CLIENTS C, COUNTRIES X, ". " PRODUCTOS P LEFT OUTER JOIN SIZES Z ON Z.ID_SIZE=P.ID_SIZE WHERE F.ID_FACTURA=I.ID_FACTURA AND F.ID_CLIENT=C.ID_CLIENT AND ". " S.ID_STATE=F.SHIPPING_ID_STATE AND X.ID_COUNTRY=F.SHIPPING_ID_COUNTRY AND P.ID_PRODUCTO=I.ID_PRODUCTO AND ". " I.ARRIVAL_DATE > $today $f $st $skw ORDER BY I.ARRIVAL_DATE DESC limit 200"; $file = "files/VM_".date("YmdHis").".CSV"; $fp = fopen($file,"w"); //echo $querys; $rs = mysql_db_query($database,$querys); echo mysql_error(); if (mysql_numrows($rs)) { $head = strtoUpper("PO Number,Member Number,Member Name,Ship-to address,City,State,Postal Code,Item Number,Item Description,Quantity ordered,Order Date,Request date,Ship Via,Special notes/instructions,Unit Cost,Box\n"); fwrite($fp,$head); ################################## #Arrancando el ciclo de despliegue while ($d = mysql_fetch_array($rs)){ $line = $d["ID_FACTURA"].",".$d["ID_CLIENT"].",".str_replace(',','',$d["SHIPPING_NAME"]." ".$d["SHIPPING_LAST_NAME"]).",".str_replace(',','',trim(str_replace(chr(13),"",$d["SHIPPING_ADDRESS"]))).",".str_replace(',','',$d["SHIPPING_CITY"]).",".$d["code"].",".$d["SHIPPING_ZIPCODE"].",".$d["ID_PRODUCTO"].",".str_replace(',','',$d["PRODUCT_DESC"]).",".$d["ID_QUANTITY"].",".$d["DATE_TIME"].",".date("m/d/Y",$d["ARRIVAL_DATE"]).",FEDEX,,".$d["ITEM_PRICE"].",".$d["box_type"]; $line = str_replace(chr(13),'',str_replace(chr(10),'',$line))."\n"; fwrite($fp,str_replace('"','',$line)); } fclose($fp); ?> <script> window.location.href='<?echo $file?>'; </script> <?
$zeros .= '0'; } $str = $zeros . $str; } $bin = $opcode . $rt . $rd . $str; } else { if ($instruction == 'SW') { $str = base_convert($rs, 16, 2); $count = strlen($str); if ($count != '16') { $zeros = ''; $num_zeros = 16 - $count; for ($x = 1; $x <= $num_zeros; $x++) { $zeros .= '0'; } $str = $zeros . $str; } $bin = $opcode . $rt . $rd . $str; } } } $hex = strtoUpper(dechex(bindec($bin))); //$hex = strtoUpper(base_convert($bin,2,16)); } } } } $dataArray = array('opcodeHex' => $hex, 'opcodeBin' => $bin); echo json_encode($dataArray); exit; ob_end_flush();