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


PHP MySQL::close方法代码示例

本文整理汇总了PHP中MySQL::close方法的典型用法代码示例。如果您正苦于以下问题:PHP MySQL::close方法的具体用法?PHP MySQL::close怎么用?PHP MySQL::close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MySQL的用法示例。


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

示例1: parseFile

function parseFile($file, $type)
{
    $sql = new MySQL();
    $sql->connect('127.0.0.1', 'root', 'root');
    $objReader = PHPExcel_IOFactory::createReader($type);
    $chunkSize = 200;
    $i = 1;
    $sql->clear('price_liga');
    $r = array();
    for ($startRow = 0; $startRow <= 5000; $startRow += $chunkSize + 1) {
        $chunkFilter = new chunkReadFilter($startRow, $chunkSize);
        $objReader->setReadFilter($chunkFilter);
        $objReader->setReadDataOnly(true);
        $objPHPExcel = $objReader->load($file);
        $data = $objPHPExcel->getActiveSheet()->toArray();
        foreach ($data as $k => $v) {
            if ($data[$k][0] == '') {
                unset($data[$k]);
            } else {
                $sql->insert('price_liga', array('id' => $i, 'cat_num' => $data[$k][0], 'brand' => ucwords(strtolower($data[$k][1])), 'article' => $data[$k][2], 'descr' => str_replace("'", "\\'", $data[$k][3]), 'model' => str_replace("'", "\\'", $data[$k][4]), 'size' => $data[$k][5], 'price' => $data[$k][6], 'amount' => $data[$k][8]), true);
                $i++;
            }
        }
    }
    //print_r($r);
    $sql->close();
    return array('counter' => $i);
}
开发者ID:herrlosxxx,项目名称:test_parser,代码行数:28,代码来源:liga.php

示例2: parseFile

function parseFile($file, $type)
{
    $sql = new MySQL();
    $sql->connect('127.0.0.1', 'root', 'root');
    $objReader = PHPExcel_IOFactory::createReader($type);
    $chunkSize = 200;
    $i = 1;
    $sql->clear('price_v8');
    for ($startRow = 0; $startRow <= 5000; $startRow += $chunkSize + 1) {
        $chunkFilter = new chunkReadFilter($startRow, $chunkSize);
        $objReader->setReadFilter($chunkFilter);
        $objReader->setReadDataOnly(true);
        $objPHPExcel = $objReader->load($file);
        $data = $objPHPExcel->getActiveSheet()->toArray();
        foreach ($data as $k => $v) {
            if (trim($data[$k][0]) == 'Артикул' || $data[$k][3] == '' || strstr($data[$k][3], 'камера') || $data[$k][7] == '') {
                unset($data[$k]);
            } else {
                $descr = str_replace('Ш', 'xSTUDEDx', trim($data[$k][3]));
                $descr = preg_replace('/[а-яА-Я]/', '', $descr);
                $sql->insert('price_v8', array('id' => $i, 'article' => trim($data[$k][0]), 'descr' => str_replace("'", "\\'", $descr), 'cat_num' => trim($data[$k][6]), 'season' => trim($data[$k][7]), 'price' => trim($data[$k][9]), 'amount' => trim(preg_replace('/[а-яА-Яa-zA-Z]{0,}/', '', $data[$k][10]))), true);
                $i++;
            }
        }
    }
    $sql->close();
    return array('counter' => $i);
}
开发者ID:herrlosxxx,项目名称:test_parser,代码行数:28,代码来源:v8.php

示例3: recalWorkers

 public static function recalWorkers()
 {
     $mysql = new MySQL();
     $rs = $mysql->runQuery("select count(id) as cnt, frequency from monitors where active=1 group by frequency;");
     $workers = 0.0;
     while ($row = mysql_fetch_array($rs, MYSQL_ASSOC)) {
         $workers += (double) $row['cnt'] / (double) $row['frequency'];
     }
     $workers = (int) ceil($workers) * 60;
     $mysql->runQuery("update settings set cronIterations={$workers};");
     $mysql->close();
 }
开发者ID:laiello,项目名称:phpmonitoring,代码行数:12,代码来源:Settings.class.php

示例4: parseFile

function parseFile($file, $type)
{
    $sql = new MySQL();
    $sql->connect('127.0.0.1', 'root', 'root');
    $objReader = PHPExcel_IOFactory::createReader($type);
    $sheets = $objReader->listWorksheetNames($file);
    $i = 1;
    $sql->clear('price_moscow');
    foreach ($sheets as $sheet) {
        $chunkSize = 200;
        if (strstr($sheet, 'Шины')) {
            $r = array();
            for ($startRow = 0; $startRow <= 4000; $startRow += $chunkSize + 1) {
                $chunkFilter = new chunkReadFilter($startRow, $chunkSize);
                $objReader->setReadFilter($chunkFilter);
                $objReader->setReadDataOnly(true);
                $objReader->setLoadSheetsOnly($sheet);
                $objPHPExcel = $objReader->load($file);
                $data = $objPHPExcel->getActiveSheet()->toArray();
                foreach ($data as $k => $v) {
                    if ($data[$k][2] == '' || $data[$k][2] == 'Модель') {
                        unset($data[$k]);
                    } else {
                        $season = strstr($data[$k][7], 'Летняя') ? 0 : (strstr($data[$k][7], 'Зимняя') ? 1 : 2);
                        $vtype = strstr($data[$k][8], 'Легковая') ? 0 : (strstr($data[$k][8], 'Грузовая') ? 1 : 2);
                        $stunds = $data[$k][10] == '' || $data[$k][10] == 'Нет' ? 0 : 1;
                        $xl = $data[$k][12] == '' || $data[$k][12] == 'Нет' ? 0 : 1;
                        $runflat = $data[$k][13] == '' || $data[$k][13] == 'Нет' ? 0 : 1;
                        $sql->insert('price_moscow', array('id' => $i, 'article' => trim($data[$k][0]), 'brand' => ucwords(strtolower(trim($data[$k][1]))), 'model' => str_replace("'", "\\'", trim($data[$k][2])), 'width' => trim($data[$k][3]), 'height' => trim($data[$k][4]), 'diameter' => (int) preg_replace('/[a-zA-Z]/', '', trim($data[$k][5])), 'weight_speed' => trim($data[$k][6]), 'season' => $season, 'v_type' => $vtype, 'studs' => $stunds, 'xl' => $xl, 'runflat' => $runflat, 'price_rrc' => $data[$k][17], 'price_opt' => $data[$k][18], 'amount' => 0), true);
                        $i++;
                    }
                }
            }
        }
    }
    $sql->close();
    return array('counter' => $i);
}
开发者ID:herrlosxxx,项目名称:test_parser,代码行数:38,代码来源:m.php

示例5: floor

            echo "<li>" . $row[$j][1] . " (" . $row[$j][2] . ") - <font color='brown'>" . $row[$j][8] . "/10</font></li>";
        }
    }
}
echo "</ol>";
$sql = "SELECT m.*, floor((((m.m_year - YEAR(p1.age)))*12 + (((01 - MONTH(p1.age)))))/12) as age  FROM movie m join movie_person p join person p1 where m.movie_id = p.movie_id and p.person_id = p1.personid and p.person_id = '" . $reqparam . "' and mtype = 'Feature Film' order by 3 asc";
$row = $db->QueryArray($sql);
echo "<hr/><br/> Feature Films:<br/>";
echo "<ol>";
for ($j = 0; $j < count($row); $j++) {
    if ($row[$j][8] >= 8) {
        echo "<li><b><font color='green'>" . $row[$j][1] . " (" . $row[$j][2] . ") </font>- <font color='brown'>" . $row[$j][8] . "/10</font></b></li>";
    } else {
        if ($row[$j][8] == 7) {
            echo "<li><font color='blue'>" . $row[$j][1] . " (" . $row[$j][2] . ") </font>- <font color='brown'>" . $row[$j][8] . "/10</font></li>";
        } else {
            echo "<li>" . $row[$j][1] . " (" . $row[$j][2] . ") - <font color='brown'>" . $row[$j][8] . "/10</font></li>";
        }
    }
}
echo "</ol>";
echo " <br/>(*<i>Favorites/Excellent/Loved It = Green; </br>&nbsp;&nbsp; Good Film/Liked It = Blue</i>). ";
?>
	  	    
	<?php 
$db->close();
?>
	<br/>
</body>
</html>
开发者ID:filmyjo,项目名称:FJMDb-Dev,代码行数:30,代码来源:printp.php

示例6: unset

                </tr>
				<?php 
        $desc = $val["TestPadreDescripcion"];
        // TestPadreDescripcion
        $tpp = $val["TestPadrePadre"];
        // TestPadrePadre
        $diagnostico = $val["OrdDiagnostico"];
        // Diagnostico
    }
    ?>
        </table>						
        <br />
	<?php 
    unset($resultados);
}
$_db->close();
?>
		
	<br />
	<?php 
if (!empty($diagnostico)) {
    ?>
		<div>
			<b>Observaciones y Comentarios a la Solicitud:</b><br/><?php 
    echo $diagnostico;
    ?>
		</div>
	<?php 
}
?>
		
开发者ID:atoledov,项目名称:siglab,代码行数:30,代码来源:printer.php

示例7: DetalleOrden


//.........这里部分代码省略.........
                                 $this->Ln();
                                 //Salto de Linea
                             }
                         }
                         if ($j == 1) {
                             $this->Cell($w[0], 6, ucwords(strtolower(str_replace(":", " ", $val["TestPadreDescripcion"]))), '', 0, 'L', false);
                             $this->Ln();
                             //Salto de Linea
                         }
                         $i++;
                         $j++;
                         break;
                 }
             }
             // Restauracion de colores y fuentes
             $this->SetFillColor(224, 235, 255);
             $this->SetTextColor(0);
             $this->SetFont('Arial', '', 9);
             /* Presenta los Resultados */
             $flag = false;
             $exa = "";
             $resul = "";
             $rango = "";
             # Verifica la Longitud del Examen
             if (strlen($val["TestDescripcion"]) >= $limite) {
                 if (strstr($val["TestDescripcion"], '<br>')) {
                     $exa = $val["TestDescripcion"];
                 } else {
                     $exa = FormatString($val["TestDescripcion"], $limite);
                     $flag = true;
                 }
             } else {
                 $exa = $val["TestDescripcion"];
             }
             # Verifica la Longitud del Resultado
             if (strlen($val["Resultado"]) >= $limite) {
                 if (strstr($val["Resultado"], '<br>')) {
                     $resul = $val["Resultado"];
                 } else {
                     $resul = FormatString($val["Resultado"], $limite);
                     $flag = true;
                 }
             } else {
                 $resul = $val["Resultado"];
             }
             # Verifica los rangos referenciales
             if (!empty($val["RanValInf"]) || !empty($val["RanValSup"])) {
                 $rango = $val["RanValInf"] . " - " . $val["RanValSup"];
             } else {
                 if (!empty($val["RanMultiple"])) {
                     $rango = str_replace("<br>", "\n", $val["RanMultiple"]);
                     $flag = true;
                 }
             }
             if (!$flag) {
                 $this->Cell($w[0], 6, $exa, 'LR', 0, 'L', $fill);
                 // Nombre del Examen
                 $this->Cell($w[1], 6, $resul, 'LR', 0, 'C', $fill);
                 // Resultado
                 $this->Cell($w[2], 6, $val["Unidad"], 'LR', 0, 'C', $fill);
                 // Unidad
                 $this->Cell($w[3], 6, $rango, 'LR', 0, 'C', $fill);
                 // Rango Minimo - Rango Maximo
             } else {
                 $this->SetFont('Arial', '', 9);
                 $this->SetWidths(array(60, 50, 25, 60));
                 if (strlen($rango) < $limite) {
                     $this->SetAligns(array('L', 'C', 'C', 'C'));
                 } else {
                     $this->SetAligns(array('L', 'C', 'C', 'L'));
                 }
                 $this->Row(array(utf8_decode(str_replace("<br/>", "\n", $exa)), utf8_decode(str_replace("<br/>", "\n", $resul)), utf8_decode($val["Unidad"]), $rango));
             }
             $this->Ln();
             $fill = !$fill;
             $desc = $val["TestPadreDescripcion"];
             // Guardo El Test Anterior - TestPadreDescripcion
             $tpp = $val["TestPadrePadre"];
             // TestPadrePadre
             $diagnostico = $val["OrdDiagnostico"];
             // Diagnostico
         }
         $this->Cell(array_sum($w), 0, '', 'T');
         $this->Ln();
         $this->Cell(200, 10, '* Sin valor legal, para ese efecto acerquese al Laboratorio Principal', 0, 0, 'C');
         $np++;
         if (count($exams) - $np != 0) {
             $this->AddPage();
         }
     }
     # Imprimo el Diagnostico
     if (!empty($diagnostico)) {
         $this->Ln(20);
         $this->SetFont('Arial', 'B', 10);
         $this->Cell(80, 6, "Observaciones y Comentarios a la Solicitud:", '', 'L', $fill);
         $this->SetFont('Arial', '', 10);
         $this->Cell(120, 6, $diagnostico, '', 'L', $fill);
     }
     $_db->close();
 }
开发者ID:atoledov,项目名称:siglab,代码行数:101,代码来源:printer_pdf.php

示例8: catch

            $gen = $result_array[$i]->gender;
            $st = $result_array[$i]->status;
            if ($i % 2 == 1) {
                $table .= "<tr class='alt'>\n\t\t\t\t\t\t\t<td><font face='Arial, Helvetica, sans-serif'>{$nm} </font></td>\n\t\t\t\t\t\t\t<td><font face='Arial, Helvetica, sans-serif'>{$tm}</font></td>\n\t\t\t\t\t\t\t<td><font face='Arial, Helvetica, sans-serif'>{$spr}</font></td>\n\t\t\t\t\t\t\t<td><font face='Arial, Helvetica, sans-serif'>{$pos}</font></td>\n\t\t\t\t\t\t\t<td><font face='Arial, Helvetica, sans-serif'>{$ispri}</font></td>\n\t\t\t\t\t\t\t<td><font face='Arial, Helvetica, sans-serif'>{$gr} </font></td>\n\t\t\t\t\t\t\t<td><font face='Arial, Helvetica, sans-serif'>{$gen}</font></td>\n\t\t\t\t\t\t\t<td><font face='Arial, Helvetica, sans-serif'>{$st} </font></td>\n\t\t\t\t\t\t</tr>";
            } else {
                $table .= "<tr>\n\t\t\t\t\t\t\t<td><font face='Arial, Helvetica, sans-serif'>{$nm} </font></td>\n\t\t\t\t\t\t\t<td><font face='Arial, Helvetica, sans-serif'>{$tm}</font></td>\n\t\t\t\t\t\t\t<td><font face='Arial, Helvetica, sans-serif'>{$spr}</font></td>\n\t\t\t\t\t\t\t<td><font face='Arial, Helvetica, sans-serif'>{$pos}</font></td>\n\t\t\t\t\t\t\t<td><font face='Arial, Helvetica, sans-serif'>{$ispri}</font></td>\n\t\t\t\t\t\t\t<td><font face='Arial, Helvetica, sans-serif'>{$gr} </font></td>\n\t\t\t\t\t\t\t<td><font face='Arial, Helvetica, sans-serif'>{$gen}</font></td>\n\t\t\t\t\t\t\t<td><font face='Arial, Helvetica, sans-serif'>{$st} </font></td>\n\t\t\t\t\t\t</tr>";
            }
            $i += 1;
        }
        if (empty($table)) {
            $table .= "<tr>\n\t\t\t\t\t\t<td><font face='Arial, Helvetica, sans-serif'>No Entries!</font></td>\n\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t<td></td>\n\t\t\t\t\t</tr>";
        }
    }
    //close database connections
    try {
        $con->close();
    } catch (Exception $e) {
        echo $e->getMessage();
    }
}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>View Squad Members</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link href="style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/cufon-yui.js"></script>
<script type="text/javascript" src="js/arial.js"></script>
<script type="text/javascript" src="js/cuf_run.js"></script>
开发者ID:reyden,项目名称:FINAL,代码行数:31,代码来源:PromoteSquadMember.php

示例9: logging

            }
            //if a pluggin doesnt return content the email will error
            if (isset($output['returnContent']) && $output['returnContent'] != '') {
                $body = $output['returnContent'];
            } else {
                $body = 'plugin returned no data';
            }
            if ((bool) $output['htmlEmail']) {
                $mail->AltBody = $body;
                $mail->MsgHTML($body);
                $mail->IsHTML = (bool) $output['htmlEmail'];
            } else {
                $mail->Body = $body;
            }
            if (!$mail->Send()) {
                echo "Mailer Error: " . $mail->ErrorInfo;
            }
        }
        //log output
        $sql = "insert into logging (monitorId,dateTime,responseTimeMs,measuredValue,returnContent,status) values({$id},now(),{$output['responseTimeMs']},'" . mysql_real_escape_string($output['measuredValue'], $mysql->mysqlCon) . "','" . mysql_real_escape_string($output['returnContent'], $mysql->mysqlCon) . "',{$output['currentStatus']});";
        $mysql->runQuery($sql);
        echo date('Y-m-d H:i:s') . "\t{$pluginType}\t{$id}\t{$name}\tEnded\t" . round($t->stop(), 0) . " ms \n";
    } else {
        $mysql->runQuery("UNLOCK TABLES;");
        //echo("UNLOCKED\n");
        //echo "no more work to do\n";
        sleep(1);
        //usleep(500*1000);	//500 milliseconds
    }
    $mysql->close();
}
开发者ID:laiello,项目名称:phpmonitoring,代码行数:31,代码来源:phpMonitorCron.php

示例10: adm_installer_addsql

function adm_installer_addsql($id)
{
    global $db_host, $db_user, $db_pass, $db_name;
    // Get information from Zantastico's DB
    $dbconn = mysql_connect('mysql.zee-way.com', 'zantastico', '');
    mysql_select_db('zp_zantastico', $dbconn);
    $sql = "SELECT * FROM zantastico WHERE id='" . $id . "'";
    $result = mysql_query($sql, $dbconn);
    $installer = mysql_fetch_assoc($result);
    // Getting filename
    $filename = substr(strrchr($installer['zip'], '/'), 1);
    // Transfer the information to this ZPanel
    $mysql = new MySQL($db_host, $db_user, $db_pass, $db_name);
    $sql = sprintf("INSERT INTO zantastico (name,version,website,welcome,instructions,finalmessage,exampledir,catid,zip,uniquekey) VALUES ('%s','%s','%s','%s','%s','%s','%s',%s,'%s','%s')", mysql_real_escape_string($installer['name']), mysql_real_escape_string($installer['version']), mysql_real_escape_string($installer['website']), mysql_real_escape_string($installer['welcome']), mysql_real_escape_string($installer['instructions']), mysql_real_escape_string($installer['finalmessage']), mysql_real_escape_string($installer['exampledir']), mysql_real_escape_string($installer['catid']), mysql_real_escape_string($filename), mysql_real_escape_string($installer['uniquekey']));
    $result = $mysql->query($sql);
    // Get Category information
    $sql = "SELECT * FROM zantastico_categories WHERE id='" . $installer['catid'] . "'";
    $result = mysql_query($sql, $dbconn);
    $category = mysql_fetch_assoc($result);
    // Create category
    $sql = sprintf("INSERT INTO zantastico_categories (id,name) VALUES ('%s','%s')", $category['id'], str_replace("'", '&apos;', $category['name']));
    $result = $mysql->query($sql);
    // Free the result in memory
    $mysql->close();
    // Instantiate the xajaxResponse object
    $objResponse = new xajaxResponse();
    //return the XML response generated by the xajaxResponse object
    return $objResponse->getXML();
}
开发者ID:BGCX261,项目名称:zpanel-svn-to-git,代码行数:29,代码来源:ajax_functions.php

示例11: die

if ($create) {
    echo "<br>Creating User " . $db2['user'] . " ... ";
    $databasename = $db2['dbase'];
    $username = $db2['user'];
    $userpass = $db2['pass'];
    include "create_user.php";
    if ($SQL->error_no != 0) {
        die(BAD . " failed! -&gt; " . $SQL->error_msg);
    } else {
        echo GOOD;
    }
}
if (defined('LOAD_MYSQL') && $create) {
    echo "<br>If there occured an custom error without " . "errornumber obove, ignore it. It seems to be a bug :(";
}
$SQL->close();
echo "<br>Connecting as User ... ";
$SQL = new MySQL($db2);
if ($SQL->error_no != 0) {
    die("<span style=\"color:red;\">User connection to database could " . "not be etablished!<br>" . "Please check your config in " . __FILE__ . " !</span>");
} else {
    echo GOOD;
}
if ($db2['create_T']) {
    echo "<br>Creating Tables ... ";
    $SQL->change_db($db2['dbase']);
    include "database.php";
    while (list(, $q) = each($table)) {
        #	echo "<br>".$q;
        if (!$SQL->query($q)) {
            die("<br>Error while doing: " . $q . " -&gt; " . $SQL->error_msg);
开发者ID:BackupTheBerlios,项目名称:unipress-svn,代码行数:31,代码来源:index.php


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