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


PHP DBConnection::insert方法代码示例

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


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

示例1: create

 static function create($title, $content, $author)
 {
     DBConnection::connect();
     DBConnection::insert('INSERT INTO post (title, content, author, pubDate) VALUES (\'' . DBConnection::getCleanVar($title) . '\', \'' . DBConnection::getCleanVar($content) . '\', ' . DBConnection::getCleanVar($author) . ', NOW())');
     return DBConnection::getDB()->insert_id;
 }
开发者ID:jekt,项目名称:blog-php,代码行数:6,代码来源:Post.php

示例2: logApiCall

 public function logApiCall($log)
 {
     $values['call_time'] = date('d-m-Y H:i:s');
     //Get caller ip
     if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
         $ip = $_SERVER['HTTP_CLIENT_IP'];
     } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
         $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
     } elseif (!empty($_SERVER['REMOTE_ADDR'])) {
         $ip = $_SERVER['REMOTE_ADDR'];
     } else {
         $ip = "not known";
     }
     $values['caller_ip'] = $ip;
     //Verplicht in $log!
     $values['url'] = $log['url'];
     $values['data'] = json_encode($log['data']);
     $values['response_code'] = $log['response_code'];
     unset($log['response']['code']);
     if ($log['response_code'] !== 200) {
         $values['response'] = $log['response']['db_code'];
     }
     $db = new DBConnection();
     $db->insert($values)->into("api_calls")->execute();
 }
开发者ID:kliptonize,项目名称:Encode,代码行数:25,代码来源:_Log.php

示例3: ajaxify

require_once "../includes/DB_Abstraction.inc";
?>
<title>Secure Your Images - ToyApp</title>
</head>
<body class="auth-user">
	<?php 
include_once "../includes/header.inc";
?>
	<div id="dash-board">
		<?php 
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $uinfo = get_user_info();
    $db = new DBConnection();
    $db->connect();
    $fid = substr($_POST['fid'], 4);
    $db->insert('temp', 'fid,uid,share', "{$fid},'{$uinfo['uid']}','{$_POST['shares']}'");
    $db->disconnect();
    //put ajax fecth code n finally display url
    ?>
<script>
function ajaxify(timer) {
		$.ajax({
			dataType : 'json',
			url: '/toyapp/includes/decrypt.inc.php?fid=<?php 
    echo $fid;
    ?>
',
			type: 'get',
			success: function(data) {	
				//alert(data['status']+' '+ data['data']);
				//ndata = JSON.parse(data);	
开发者ID:vishnuvp,项目名称:toyapp,代码行数:31,代码来源:secure_reconstruct.php

示例4: DBConnection

<?php

require_once '../model/DBConnection.php';
$db = new DBConnection();
/*
 * INSERT TEST.
 */
$lastInsertedId = $db->insert('truck', array('vehicle_capacity' => 0, 'brand' => 'Scania', 'age' => 4));
echo '<p> Last Inserted ID: ' . $lastInsertedId . '</p>';
/*
 * SELECT SINGLE TEST.
 */
echo '<p> All columns: ';
var_dump($db->select('truck', '*', 'id', $lastInsertedId));
echo '</p>';
echo '<p> Some columns: ';
var_dump($db->select('truck', array('brand', 'age'), 'id', $lastInsertedId));
echo '</p>';
/*
 * SELECT ALL TEST.
 */
$db->insert('truck', array('brand' => 'Mercedes', 'age' => 3));
echo '<p> All rows and columns: ';
var_dump($db->select('truck', '*'));
/*
 * UPDATE TEST.
 */
echo '<p> Before update: ';
var_dump($db->select('truck', '*', 'id', $lastInsertedId));
echo '</p>';
$db->update('truck', array('vehicle_capacity' => 0, 'brand' => 'MAN', 'age' => 0), $lastInsertedId);
开发者ID:stoykovnet,项目名称:SmoothTransport,代码行数:31,代码来源:DBConnection.php

示例5: foreach

			});
	}

</script>

<?php 
$login = $_POST['postlogin'];
$name = $_POST['postname'];
$password = $_POST['postpass'];
$email = $_POST['postemail'];
$endereco = $_POST['postendereco'];
$cidade = $_POST['postcidade'];
$telefone = $_POST['posttelefone'];
$documento = $_POST['postdocumento'];
$pais = $_POST['postpais'];
$loginStats = false;
$emailStats = false;
$data = DBConnection::select("Select * from hospede");
foreach ($data as $row) {
    if ($row['HonLog'] == $login) {
        $loginStats = true;
    }
    if ($row['HonEma'] == $email) {
        $loginStats = true;
    }
}
if ($loginStats) {
    echo "<script>signUp2()</script>";
} else {
    DBConnection::insert('Insert INTO hospede (HosNom,HosLog,HosPas,HosEma,HosEnd,HosCid,HosTel,HosDoc,HosPai) values("' . $name . '","' . $login . '","' . $password . '","' . $email . '","' . $endereco . '","' . $cidade . '","' . $telefone . '","' . $documento . '","' . $pais . '")');
}
开发者ID:misticsz,项目名称:HotelResbeweard-,代码行数:31,代码来源:confirmCadastro.php

示例6: sizeof

    $N = $sent[0];
    $K = $sent[1];
    $command = '/usr/bin/python /var/www/html/toyapp/toyapp-python/toyapp.py encrypt ' . $file_name . ' ' . $N . ' ' . $K;
    echo $command;
    //echo '<br />'.$command;
    //echo '<br />';
    #$result = #exec($command);#
    $result = json_decode(exec($command, $status), true);
    $size = sizeof($result);
    //print_r($result);
    $i = 0;
    require_once '../includes/shareholdersapi.inc';
    $shareholders = get_shareholders($sent[2]);
    //print_r($shareholders);
    require_once '../includes/DB_Abstraction.inc';
    $db_con = new DBConnection();
    $db_con->connect();
    foreach ($result as $pair) {
        $uid = $shareholders[$i]['uid'];
        $db_con->insert('secrets', 'fid,uid,secret', "{$sent['2']},'{$uid}','[{$pair['0']},{$pair['1']}]'");
        $i++;
        echo "<br />Secret {$i}: <input type='text' readonly='readonly' value='[{$pair['0']},{$pair['1']}]'/>";
    }
    //print_r($result);//. ' <br />';
    $db_con->update('file', "url='\\/toyapp\\/repo\\/{$fn}.enc',status=2", "fid={$sent['2']}");
    $db_con->disconnect();
    //unlink($file_name);
}
?>
</body>
</html>
开发者ID:vishnuvp,项目名称:toyapp,代码行数:31,代码来源:file_upload.php

示例7: submit_new

 /**
  * Insert selected instance of this type in the database. The instance will 
  * not be inserted if it does not contain any data.
  * Returns the ID of the inserted instance on success.
  * @return int|null
  */
 public function submit_new()
 {
     $db = new DBConnection();
     $dataToInsert = array();
     foreach ($this->classFields as $variable => $value) {
         if ($value) {
             $dataToInsert[$variable] = $value;
         }
     }
     if (count($dataToInsert)) {
         return $db->insert($this->convert_to_table_name($this->get_class_name()), $dataToInsert);
     } else {
         return null;
     }
 }
开发者ID:stoykovnet,项目名称:SmoothTransport,代码行数:21,代码来源:ModelTemplate.php


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