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


PHP Mysql::update方法代码示例

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


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

示例1: removeProduct

 public static function removeProduct($barcode, $expiration)
 {
     $mysql = new Mysql();
     $update = $mysql->update("delete from product where barcode='{$barcode}' and expiration='{$expiration}'");
     $mysql->closeConnection();
     return $update;
 }
开发者ID:AyanUR,项目名称:WebApplication,代码行数:7,代码来源:ProductDAO.php

示例2: save

 public static function save(Music $music)
 {
     $data = ['id' => $music->id, 'band' => $music->band_name, 'album' => $music->album_name, 'year' => $music->year];
     if ($data['id'] !== null) {
         Mysql::update('UPDATE music SET band_name = ?, album_name = ?, year = ? WHERE id = ?', [$data['band'], $data['album'], $data['year'], $data['id']]);
     } else {
         Mysql::insert('INSERT INTO music (band_name, album_name, year) VALUES (?, ?, ?)', [$data['band'], $data['album'], $data['year']]);
     }
 }
开发者ID:Brunoalves3,项目名称:bruno,代码行数:9,代码来源:MusicTable.php

示例3: save

 function save()
 {
     $champsUpdate = array('nom' => $_REQUEST['nom'], 'adresse' => $_REQUEST['adresse'], 'cp' => $_REQUEST['cp'], 'ville' => $_REQUEST['ville'], 'telephone' => $_REQUEST['telephone'], 'email' => $_REQUEST['email'], 'site_web' => $_REQUEST['site_web'], 'nom_contact' => $_REQUEST['nom_contact'], 'prenom_contact' => $_REQUEST['prenom_contact'], 'tel_contact' => $_REQUEST['tel_contact'], 'portable_contact' => $_REQUEST['portable_contact'], 'email_contact' => $_REQUEST['email_contact'], 'temperature' => $_REQUEST['temperature'], 'dirigeant' => $_REQUEST['dirigeant'], 'naf' => $_REQUEST['naf'], 'autre' => $_REQUEST['autre']);
     $champsInsert = $champsUpdate;
     $id = $_REQUEST['id'];
     if ($id) {
         // Update
         Mysql::update($this->table, $champsUpdate, "WHERE `id` = '%d'", $id);
     } else {
         // Insert
         $id = Mysql::insert($this->table, $champsInsert);
     }
     $this->redirect($id);
     // Rechargement de la page avec l'Bien courant
 }
开发者ID:bsdroot,项目名称:speervi,代码行数:15,代码来源:index.php

示例4: foreach

    foreach ($KeyList as $k => $v) {
        if (!isset($_GET[$v])) {
            $res = ['ok' => 0, 'error' => "param invalid "];
            echo json_encode($res);
            return;
        }
    }
}
$mysql = new Mysql();
//连接数据库
$myMemcache = new MyMemcache();
if (isset($_GET['footId'])) {
    $_GET['like'] = $myMemcache->get("like" . $_GET['footId']) ? $myMemcache->get("like" . $_GET['footId']) + 1 : 1;
    $_GET['id'] = $_GET['footId'];
    $FootList = array('id', 'like');
    $mysql->update("foot", "like", "{$_GET['like']}", "id", "{$_GET['id']}");
} else {
    $memValue = $myMemcache->get($_GET['url']);
    if ($memValue) {
        $_GET['id'] = $memValue;
        $footprintId = $myMemcache->get($_GET['userId'] . "foot:" . $_GET['id']);
        if ($footprintId) {
            echo json_encode(['ok' => 1, 'data' => [id => $footprintId]]);
            die;
        }
        $_GET['like'] = $myMemcache->get("like" . $_GET['id']) ? $myMemcache->get("like" . $_GET['id']) + 1 : 1;
        $FootList = array('url', 'title', 'id', 'like');
    } else {
        $_GET['like'] = 1;
        $FootList = array('url', 'title');
    }
开发者ID:shaoshao613,项目名称:footprint,代码行数:31,代码来源:logger.php

示例5: ModifierLaRencontre

function ModifierLaRencontre($id_rencontre, $id_societe, $date_rencontre, $commentaire, $type_rencontre)
{
    return Mysql::update('rencontre', array('id_societe' => $id_societe, 'date_rencontre' => $date_rencontre, 'commentaire' => $commentaire), "WHERE id = '%d' ", $id_rencontre);
}
开发者ID:bsdroot,项目名称:speervi,代码行数:4,代码来源:fonctions_mysql.php

示例6: delete

                $string .= $this->setQuoteStyle($key) . "='" . $this->safeFilter($val) . "'";
            } else {
                $string .= ',' . $this->setQuoteStyle($key) . "='" . $this->safeFilter($val) . "'";
            }
        }
        $sql = 'UPDATE ' . $this->setQuoteStyle($table) . ' SET ' . $string . ($where === NULL ? $where : ' WHERE ' . $where);
        echo $sql;
        //mysql_query ( $sql, $this->_link );
    }
    function delete($table, $where = NULL)
    {
        $sql = 'DELETE FROM ' . $this->setQuoteStyle($table) . ($where == NULL ? $where : ' WHERE ' . $where);
        echo $sql;
        mysql_query($sql, $this->_link);
    }
    function setQuoteStyle($key)
    {
        return '`' . $key . '`';
    }
    function safeFilter($value)
    {
        return mysql_real_escape_string($value, $this->_link);
    }
}
// 创建对象
$bind = array('username' => "1'1", 'password' => "2'1", 'age' => 112, 'sex' => 1);
$db = new Mysql();
$x = $db->connect('localhost', 'root', 'root', 'test');
//var_dump($x);
$db->update('users', $bind, 'id=1');
开发者ID:denson7,项目名称:phpstudy,代码行数:30,代码来源:Mysql.class.php


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