本文整理汇总了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;
}
示例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']]);
}
}
示例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
}
示例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');
}
示例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);
}
示例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');