当前位置: 首页>>代码示例>>PHP>>正文


PHP begin函数代码示例

本文整理汇总了PHP中begin函数的典型用法代码示例。如果您正苦于以下问题:PHP begin函数的具体用法?PHP begin怎么用?PHP begin使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了begin函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: crearItemsDeCarga

 function crearItemsDeCarga($id)
 {
     begin();
     if ($this->cargaExists($id)) {
         if (!$this->eliminarItemsDeCarga($id)) {
             rollback();
         }
     }
     $sql = "INSERT INTO cargas (id_reparto, id_producto, cantidad, fecha_update)\n                SELECT  t1.id_reparto, \n                        t4.id_producto,\n                        SUM(t3.cantidad_detalle_venta) cantidad,\n                        NOW()\n                FROM repartos t1\n                INNER JOIN ventas t2 ON t1.id_reparto=t2.id_reparto\n                INNER JOIN detalle_ventas t3 ON t2.id_venta=t3.id_venta\n                INNER JOIN productos t4 ON t3.id_producto=t4.id_producto\n                WHERE t1.id_reparto != 1 AND t1.id_reparto = {$id}\n                GROUP BY t4.id_producto\n                ORDER BY detalle_producto";
     if (!mysql_query($sql)) {
         die('Error: ' . mysql_error());
         rollback();
         return false;
     } else {
         commit();
         return true;
     }
 }
开发者ID:sugarnet,项目名称:feanor-sg1,代码行数:18,代码来源:ExpertoRepartos.php

示例2: begin

function begin()
{
    echo "\r\n+------------------------\r\n| [ 1 ] 生成Model \r\n| [ 2 ] 生成Action  \r\n| [ 0 ] 退出\r\n+------------------------\r\n输入数字选择:";
    $number = trim(fgets(STDIN, 256));
    //fscanf(STDIN, "%d\n", $number); // 从 STDIN 读取数字
    switch ($number) {
        case 0:
            break;
        case 1:
            echo "输入Model名称[例如 User,留空生成当前数据库的全部Model类 ]:";
            $model = trim(fgets(STDIN, 256));
            if (strpos($model, ',')) {
                echo "批量生成Model...\n";
                $models = explode(',', $model);
                foreach ($models as $model) {
                    buildModel($model);
                }
            } else {
                // 生成指定的Model类
                buildModel($model);
            }
            begin();
            break;
        case 2:
            // 生成指定的Action类
            echo "输入Action名称[例如 User ]:";
            $action = trim(fgets(STDIN, 256));
            buildAction($action);
            begin();
            break;
        default:
            begin();
    }
}
开发者ID:skiman100,项目名称:thinksns,代码行数:34,代码来源:common.php

示例3: insert_sql_data

function insert_sql_data( $db_conn, $p_campaigns, $p_headers, $p_details )
// insert the header and detail data into the file
// with appropriate safeguards to ensure full 
// completion or rollback of the transaction.
{
GLOBAL $msg_log;

	$success = TRUE;
// Wrap all this in a transaction
// First, turn off autocommit
	$qry = "set autocommit=0";
//pre_echo( $qry );
	$success = mysql_query( $qry, $db_conn );

// Second, take care of all ALTER TABLE queries.  Due to a (documented)
// glitch in MySQL, these commands force a transaction to commit, 
// which sucks.

	if ($success) 
	{ // Create the temp_header table
		$qry = "CREATE TEMPORARY TABLE temp_header LIKE contract_header";
//pre_echo( $qry );
		$success = mysql_query( $qry, $db_conn );
		if (!$success) 
		{
			message_log_append( $msg_log, mysql_error( $db_conn ), MSG_LOG_ERROR );
		}
	}

	if ($success) 
	{ // Create the temp_detail table
		$qry = "CREATE TEMPORARY TABLE temp_detail LIKE contract_detail";
//pre_echo( $qry );
		$success = mysql_query( $qry, $db_conn );
		if (!$success)
		{
			message_log_append( $msg_log, mysql_error( $db_conn ), MSG_LOG_ERROR );
		}
	}

	if ($success) 
	{ // Delete the Seq field from table temp_header
		$qry = "ALTER TABLE temp_header DROP COLUMN Seq";
//pre_echo( $qry );
		$success = mysql_query( $qry, $db_conn );
		if (!$success)
		{
			message_log_append( $msg_log, mysql_error( $db_conn ), MSG_LOG_ERROR );
		}
	}

    if ($success) 
	{ // Delete the Line column from table temp_detail
		$qry = "ALTER TABLE temp_detail DROP COLUMN Line";
//pre_echo( $qry );
		$success = mysql_query( $qry, $db_conn );
		if (!$success)
		{
			message_log_append( $msg_log, mysql_error( $db_conn ), MSG_LOG_ERROR );
		}
	}

// loop through the campaigns, headers, and details to insert the
// data into the SQL database.  Keep solid track of all error
// results so that we can ROLLBACK on any error.
	if ($success) 
	{
//echo "<pre>";
//var_dump( $p_campaigns );  echo "</pre><br>";
		$success = begin( $db_conn );
		if (!$success)
		{
			message_log_append( $msg_log, "Error in START TRANSACTION: " . mysql_error( $db_conn ), MSG_LOG_ERROR );
		}
	}

// do the work here, and keep track of $success
// If we need to create a new agency record, do that here.
	$new_agency = FALSE;
	if ($success && is_null( $p_campaigns[0][ 'Agency Record' ])) 
	{
		$agent_name = $p_campaigns[0][ 'Agency Name' ];
		$rate = DEFAULT_AGENCY_RATE / 10;
		if ($success = agency_insert( $db_conn, $agent_name, $rate, $aindex )) 
		{
			$p_campaigns[0][ 'Agency Record' ] = agency_record( $agent_name, OPERATOR_NAME );
			$success = !is_null( $p_campaigns[0][ 'Agency Record' ]);
		} // if agency_insert
		if ($success) 
		{
			$new_agency = TRUE;
			message_log_append( $msg_log, "Agency created: " .
			"Seq = $aindex, Name = '$agent_name'", MSG_LOG_WARNING );
		} 
		else 
		{
			message_log_append( $msg_log, "Error while creating " . "Agency '$agent_name': " . mysql_error( $db_conn ), MSG_LOG_ERROR );
		}
	} // if null agency record

//.........这里部分代码省略.........
开发者ID:agundran,项目名称:addige,代码行数:101,代码来源:insert_sql.php

示例4: save

 function save($oData)
 {
     if (!$oData["id_orden_compra"]) {
         begin();
         $detalle = array();
         $cabecera = array();
         $cabecera = explode("@@", $oData["cabecera"]);
         $detalle = explode("||", $oData["detalle"]);
         $sql = "INSERT INTO  ordenes_compra (id_proveedor, fecha_orden_compra, nro_orden_compra, generada)\r\n\t\t\t\t\tVALUES (" . $cabecera[0] . ", '" . dateToMySQL($cabecera[1]) . "', " . $cabecera[2] . ", 1)";
         if (!mysql_query($sql)) {
             die('Error: ' . mysql_error());
             rollback();
             return false;
         } else {
             $id = mysql_insert_id();
             foreach ($detalle as $detail) {
                 $values = explode("@@", $detail);
                 $sql = "INSERT INTO detalle_ordenes_compra (id_orden_compra, id_producto, cantidad_detalle_orden_compra) VALUES  (" . $id . ", " . $values[0] . ", " . $values[1] . ")";
                 if (!mysql_query($sql)) {
                     die('Error: ' . mysql_error());
                     rollback();
                     break;
                 }
             }
             if ($cabecera[2]) {
                 $nroVta = $cabecera[2] + 1;
             }
             $sql = "UPDATE parametros SET valor_parametro = " . $nroVta . " WHERE nombre_parametro='nro_orden_compra'";
             if (!mysql_query($sql)) {
                 die('Error: ' . mysql_error());
                 rollback();
                 break;
             } else {
                 commit();
                 return true;
             }
             return false;
         }
     } else {
         $sql = "delete from detalle_ordenes_compra where id_orden_compra=" . $oData["id_orden_compra"];
         getRS($sql);
         $sql = "delete from ordenes_compra where id_orden_compra=" . $oData["id_orden_compra"];
         getRS($sql);
         begin();
         $detalle = array();
         $cabecera = array();
         $cabecera = explode("@@", $oData["cabecera"]);
         $detalle = explode("||", $oData["detalle"]);
         $sql = "INSERT INTO  ordenes_compra (id_proveedor, fecha_orden_compra, nro_orden_compra, generada)\r\n\t\t\t\t\tVALUES (" . $cabecera[0] . ", '" . dateToMySQL($cabecera[1]) . "', " . $cabecera[2] . ", 1)";
         if (!mysql_query($sql)) {
             die('Error: ' . mysql_error());
             rollback();
             return false;
         } else {
             $id = mysql_insert_id();
             foreach ($detalle as $detail) {
                 $values = explode("@@", $detail);
                 $sql = "INSERT INTO detalle_ordenes_compra (id_orden_compra, id_producto, cantidad_detalle_orden_compra) VALUES  (" . $id . ", " . $values[0] . ", " . $values[1] . ")";
                 if (!mysql_query($sql)) {
                     die('Error: ' . mysql_error());
                     rollback();
                     break;
                 }
             }
             if ($cabecera[2]) {
                 $nroVta = $cabecera[2] + 1;
             }
             $sql = "UPDATE parametros SET valor_parametro = " . $nroVta . " WHERE nombre_parametro='nro_orden_compra'";
             if (!mysql_query($sql)) {
                 die('Error: ' . mysql_error());
                 rollback();
                 break;
             } else {
                 commit();
                 return true;
             }
             return false;
         }
     }
 }
开发者ID:sugarnet,项目名称:feanor-sg1,代码行数:80,代码来源:ExpertoOrdenes.php

示例5: begin

function begin($startX, $startY)
{
    if ($startY > 0 && $startY == $startX) {
        begin($startY - 1, $startY - 1, $board);
    }
    if ($startX > 0) {
        begin($startX - 1, $startY, $board);
    }
    $board = newBoard();
    $board[$startY][$startX] = 1;
    //the first move location will be "1"
    echo "Starting at: (" . $startY . "," . $startX . ")\n";
    $solution = solve($board, $startY, $startX, 2);
}
开发者ID:valdas,项目名称:knit,代码行数:14,代码来源:knights.php

示例6: do_install

function do_install()
{
    // {{{
    if (isset($_POST['database_type']) && isset($_POST['database_host']) && isset($_POST['database_user']) && isset($_POST['database_name'])) {
        global $database_dsn;
        $database_dsn = "{$_POST['database_type']}:user={$_POST['database_user']};password={$_POST['database_password']};host={$_POST['database_host']};dbname={$_POST['database_name']}";
        install_process();
    } else {
        if (file_exists("auto_install.conf")) {
            install_process(trim(file_get_contents("auto_install.conf")));
            unlink("auto_install.conf");
        } else {
            begin();
        }
    }
}
开发者ID:nsuan,项目名称:shimmie2,代码行数:16,代码来源:install.php

示例7: rewind

 public function rewind()
 {
     begin($this->_config);
 }
开发者ID:Nivl,项目名称:Ninaca,代码行数:4,代码来源:Configuration.php

示例8: lexer_performAction

 function lexer_performAction(&$yy, $yy_, $avoiding_name_collisions, $YY_START = null)
 {
     $YYSTATE = $YY_START;
     switch ($avoiding_name_collisions) {
         case 0:
             return 15;
             break;
         case 1:
             return 15;
             break;
         case 2:
             this . popState();
             this . begin('STRING');
             return 11;
             break;
         case 3:
             this . popState();
             return 15;
             break;
         case 4:
             this . begin('SINGLE_QUOTE_ON');
             return 'SINGLE_QUOTE_ON';
             break;
         case 5:
             this . begin('SINGLE_QUOTE_ON');
             return 10;
             break;
         case 6:
             return 15;
             break;
         case 7:
             return 15;
             break;
         case 8:
             this . popState();
             this . begin('STRING');
             return 11;
             break;
         case 9:
             this . popState();
             return 15;
             break;
         case 10:
             this . begin('DOUBLE_QUOTE_ON');
             return 10;
             break;
         case 11:
             this . begin('DOUBLE_QUOTE_ON');
             return 10;
             break;
         case 12:
             return 14;
             break;
         case 13:
             this . popState();
             return 7;
             break;
         case 14:
             this . popState();
             return 13;
             break;
         case 15:
             return 12;
             break;
         case 16:
             return 15;
             break;
         case 17:
             return 15;
             break;
         case 18:
             return 15;
             break;
         case 19:
             return 15;
             break;
         case 20:
             return 8;
             break;
         case 21:
             this . begin('STRING');
             return 15;
             break;
         case 22:
             return 5;
             break;
     }
 }
开发者ID:gokhanbhs,项目名称:jquerysheet,代码行数:88,代码来源:tsv.php

示例9: begin

<?php

/* 
 * The MIT License
 *
 * Copyright 2015 ekow.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
begin()->table('some_table')->column('id')->type('integer')->nulls(false)->column('some_field')->type('string')->column('another_field')->type('string')->primaryKey('id')->autoIncrement()->end();
开发者ID:codogh,项目名称:yentu,代码行数:26,代码来源:12345678901234_some_table.php

示例10: saveIndiceEstacional

 function saveIndiceEstacional($oData)
 {
     begin();
     $sql = "SELECT * FROM indices_estacionales WHERE id_producto = " . $oData["id_producto"];
     $result = getRS($sql);
     if (!getNrosRows($result)) {
         $dur_periodo = $this->getDuracionPeriodo();
         $cant_dias_anio = date("z", mktime(0, 0, 0, 12, 31, date("Y"))) + 1;
         $periodo_x_anio = number_format($cant_dias_anio / $dur_periodo);
         for ($i = 0; $i < $periodo_x_anio; $i++) {
             if ($i + 1 == $oData["nro_estacion"]) {
                 $sql = "INSERT INTO indices_estacionales (id_producto, orden, valor) VALUES (" . $oData["id_producto"] . "," . ($i + 1) . ", " . $oData["indice_estacional"] . ")";
             } else {
                 $sql = "INSERT INTO indices_estacionales (id_producto, orden) VALUES (" . $oData["id_producto"] . "," . ($i + 1) . ")";
             }
             $rs = getRS($sql);
             if (!$rs) {
                 die('Error: ' . mysql_error());
                 rollback();
             } else {
                 commit();
             }
         }
     } else {
         $sql = "SELECT * FROM indices_estacionales WHERE id_producto = " . $oData["id_producto"] . " and orden = " . $oData["nro_estacion"];
         $result = getRS($sql);
         if (!getNrosRows($result)) {
             $sql = "INSERT INTO indices_estacionales (id_producto, orden, valor) VALUES (" . $oData["id_producto"] . "," . $oData["nro_estacion"] . ", " . $oData["indice_estacional"] . ")";
             $rs = getRS($sql);
             if (!$rs) {
                 die('Error: ' . mysql_error());
                 rollback();
             }
         } else {
             $sql = "UPDATE indices_estacionales SET valor = " . $oData["indice_estacional"] . " WHERE id_producto = " . $oData["id_producto"] . " AND orden = " . $oData["nro_estacion"];
             $rs = getRS($sql);
             if (!$rs) {
                 die('Error: ' . mysql_error());
                 rollback();
             }
         }
     }
 }
开发者ID:sugarnet,项目名称:feanor-sg1,代码行数:43,代码来源:ExpertoPrediccion.php

示例11: file_begin

function file_begin($filename)
{
    return begin(explode(".", $filename));
}
开发者ID:pawelzielak,项目名称:opencaching-pl,代码行数:4,代码来源:remotelogbook.php

示例12: mysql_error

	//Verificando que la conexion se haya hecho a la BD
	if (!$conexion_base) {
		die ('No se encuentra la base de datos seleccionada : ' . mysql_error());
	}
	
	$lNumber = $_POST['leaseNum'];
	$sDate = $_POST['sDate'];
	$eDate = $_POST['eDate'];
	$duration = $_POST['duration'];
	$studentID = $_POST['student'];
	$placeNum = $_POST['room'];
	

	$contrato = "INSERT INTO Lease VALUES ('$lNumber', '$sDate', '$eDate', '$duration', '$studentID', '$placeNum')";
	begin(); // Empieza la transaccion
	$result = mysql_query($contrato);
	
	if(!$result) {
		
		rollback(); // Si hubo un error se le da rollback
		echo 'Hubo un error';
		exit;
	}
	
	else {
		commit(); //Si fue exitosa se lleva a cabo
		echo 'Operación realizada con éxito';
	}
	
	
开发者ID:rkrdo,项目名称:university,代码行数:28,代码来源:insertar_contrato.php

示例13: do_install

function do_install()
{
    // {{{
    if (isset($_POST['database_dsn'])) {
        install_process($_POST['database_dsn']);
    } else {
        if (file_exists("auto_install.conf")) {
            install_process(trim(file_get_contents("auto_install.conf")));
            unlink("auto_install.conf");
        } else {
            begin();
        }
    }
}
开发者ID:kmcasto,项目名称:shimmie2,代码行数:14,代码来源:install.php

示例14: begin

<?php

/* 
 * The MIT License
 *
 * Copyright 2014 ekow.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
begin()->table('roles')->column('role_name')->type('string')->nulls(false)->table('users')->column('user_name')->rename('username')->end();
开发者ID:codogh,项目名称:yentu,代码行数:26,代码来源:12345678901234_noschema.php

示例15: getMicroTime

<html>
  <body>
    <?php 
$scriptName = "ViewUserInfo.php";
include "PHPprinter.php";
$startTime = getMicroTime();
$userId = $HTTP_POST_VARS['userId'];
if ($userId == null) {
    $userId = $HTTP_GET_VARS['userId'];
    if ($userId == null) {
        printError($scriptName, $startTime, "Viewing user information", "You must provide an item identifier!<br>");
        exit;
    }
}
getDatabaseLink($link);
begin($link);
$userResult = mysql_query("SELECT * FROM users WHERE users.id={$userId}", $link) or die("ERROR: Query failed");
if (mysql_num_rows($userResult) == 0) {
    commit($link);
    die("<h3>ERROR: Sorry, but this user does not exist.</h3><br>\n");
}
printHTMLheader("RUBiS: View user information");
// Get general information about the user
$userRow = mysql_fetch_array($userResult);
$firstname = $userRow["firstname"];
$lastname = $userRow["lastname"];
$nickname = $userRow["nickname"];
$email = $userRow["email"];
$creationDate = $userRow["creation_date"];
$rating = $userRow["rating"];
print "<h2>Information about " . $nickname . "<br></h2>";
开发者ID:michaelprem,项目名称:phc,代码行数:31,代码来源:ViewUserInfo.php


注:本文中的begin函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。