本文整理汇总了PHP中Mysql::escape方法的典型用法代码示例。如果您正苦于以下问题:PHP Mysql::escape方法的具体用法?PHP Mysql::escape怎么用?PHP Mysql::escape使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mysql
的用法示例。
在下文中一共展示了Mysql::escape方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add
public function add()
{
$reValue = 0;
$mysql = new Mysql();
$sql = "insert into " . $mysql->dbpre . "memo" . $mysql->debug . "(ProjectId,Memo,CreateTime,UserId) values(\n\t\t" . intval($this->ProjectId) . ",\n\t\t'" . $mysql->escape($this->Memo) . "',\n\t\t'" . $mysql->escape($this->CreateTime) . "',\n\t\t" . intval($this->UserId) . "\n\t\t)";
//echo $sql;
$mysql->runSql($sql);
$reValue = $mysql->lastId();
$mysql->closeDb();
return $reValue;
}
示例2: add
public function add()
{
$reValue = 0;
$mysql = new Mysql();
$sql = "insert into " . $mysql->dbpre . "hours" . $mysql->debug . "(ProjectId,Memo,CreateTime,UserId,Hours1,Ratio,Hours2,WorkDate) values(\n\t\t" . intval($this->ProjectId) . ",\n\t\t'" . $mysql->escape($this->Memo) . "',\n\t\t'" . $mysql->escape($this->CreateTime) . "',\n\t\t" . intval($this->UserId) . ",\n\t\t" . floatval($this->Hours1) . ",\n\t\t" . floatval($this->Ratio) . ",\n\t\t" . floatval($this->Hours2) . ",\n\t\t'" . $mysql->escape($this->WorkDate) . "'\n\t\t)";
//echo $sql;
$mysql->runSql($sql);
$reValue = $mysql->lastId();
$mysql->closeDb();
return $reValue;
}
示例3: add
public function add()
{
$reValue = 0;
$mysql = new Mysql();
$sql = "insert into boguan_tubu_invit (Name,Phone,Address,CreateTime) values(\n \t\t'" . $mysql->escape($this->Name) . "',\n '" . $mysql->escape($this->Phone) . "',\n \t\t'" . $mysql->escape($this->CreateTime) . "'\n \t\t)";
//echo $sql;
$mysql->runSql($sql);
$reValue = $mysql->lastId();
if ($mysql->errno() == 1062) {
$reValue = -1;
}
$mysql->closeDb();
return $reValue;
}
示例4: updateOpenIdQQ
public function updateOpenIdQQ()
{
$mysql = new Mysql();
$sql = "update " . $mysql->dbpre . "user" . $mysql->debug . " set \n\t\t\tOpenIdQQ='" . $mysql->escape($this->OpenIdQQ) . "'\n\t\t\t WHERE UserId=" . intval($this->UserId);
$mysql->runSql($sql);
$result = $mysql->affectedRows();
$mysql->closeDb();
return $result;
}
示例5: addOrEditCategory
function addOrEditCategory($id, $description, $displayOrder, $status, $name, $nameUrl, $parentId, $image)
{
$mysql = new Mysql();
// @helu time 2014-06-13
//判断别名是否添加过如果添加过则不能添加
$sqlAlias = "SELECT COUNT(nameurl) as countId, id FROM " . $mysql->dbpre . "category" . $mysql->debug;
$sqlAlias .= " WHERE nameurl= '" . $mysql->escape($nameUrl) . "'";
$aliasRes = $mysql->getData($sqlAlias);
$aliasCount = intval($aliasRes[0]['countId']);
$aliasId = $aliasRes[0]['id'];
// var_dump( $id );
// var_dump( $aliasCount );
// var_dump( $aliasId );
// exit;
if ($aliasCount === 1) {
if (empty($id) || $id != $aliasId) {
$result = array();
$result['Success'] = false;
$result['Code'] = -1;
// -1 : 别名已经添加过
$mysql->closeDb();
return $result;
}
}
if ($id > 0) {
$sqlformat = "update %scategory%s set Description='%s',DisplayOrder=%d,status=%d,name='%s',nameurl='%s',parentid=%d,image='%s' where id=%d and belong=%d";
$sql = sprintf($sqlformat, $mysql->dbpre, $mysql->debug, $mysql->escape($description), intval($displayOrder), intval($status), $mysql->escape($name), $mysql->escape($nameUrl), intval($parentId), $mysql->escape($image), intval($id), intval($this->Belong));
} else {
$sqlformat = "insert into %scategory%s (Description,DisplayOrder,status,Name,NameUrl,ParentId,Image,Belong,Creator) values('%s',%d,%d,'%s','%s',%d,'%s',%d,%d)";
$sql = sprintf($sqlformat, $mysql->dbpre, $mysql->debug, $mysql->escape($description), intval($displayOrder), intval($status), $mysql->escape($name), $mysql->escape($nameUrl), intval($parentId), $mysql->escape($image), intval($this->Belong), intval($this->Creator));
}
$result = $mysql->runSql($sql);
$mysql->closeDb();
return $result;
}
示例6: update
function update()
{
$mysql = new Mysql();
if ($this->EditFast) {
$sql = "update " . $mysql->dbpre . "post" . $mysql->debug . " set " . "DisplayOrder=" . intval($this->DisplayOrder) . ", Subject='" . $mysql->escape($this->Subject) . "',status=" . intval($this->Status) . ",DisplayDate='" . $mysql->escape($this->DisplayDate) . "',commentStatus=" . intval($this->CommentStatus) . " where id=" . intval($this->Id) . " and belong=" . intval($this->Belong);
} else {
$sql = "update " . $mysql->dbpre . "post" . $mysql->debug . " set ChildIds='" . $mysql->escape($this->ChildIds) . "', Subject='" . $mysql->escape($this->Subject) . "',DisplayOrder=" . intval($this->DisplayOrder) . ",status=" . intval($this->Status) . ",content='" . $mysql->escape($this->Content) . "',Summary='" . $mysql->escape($this->Summary) . "',commentStatus=" . intval($this->CommentStatus) . ",image='" . $mysql->escape($this->Image) . "',tags='" . $mysql->escape($this->Tags) . "',Keywords='" . $mysql->escape($this->Keywords) . "',Memo='" . $mysql->escape($this->Memo) . "',Link='" . $mysql->escape($this->Link) . "',Source='" . $mysql->escape($this->Source) . "',DisplayDate='" . $mysql->escape($this->DisplayDate) . "',categoryIds='," . $mysql->escape($this->CategoryIds) . ",' where id=" . intval($this->Id) . " and belong=" . intval($this->Belong);
}
// var_dump( $sql );
// exit;
$mysql->runSql($sql);
$mysql->closeDb();
return true;
}
示例7: update
public function update()
{
$mysql = new Mysql();
$sql = "update " . $mysql->dbpre . "project" . $mysql->debug . " set \n\t\t\tSubject='" . $mysql->escape($this->Subject) . "',\n\t\t\tType=" . intval($this->Type) . ",\n\t\t\tDepartment=" . intval($this->Department) . ",\n\t\t\tTeam=" . intval($this->Team) . ",\n\t\t\tPublishTime='" . $mysql->escape($this->PublishTime) . "',\n\t\t\tStatus='" . $mysql->escape($this->Status) . "',\n\t\t\tHours='" . $mysql->escape($this->Hours) . "',\n\t\t\tDeveloper='" . $mysql->escape($this->Developer) . "',\n\t\t\tSchedule='" . $mysql->escape($this->Schedule) . "',\n\t\t\tDetail='" . $mysql->escape($this->Detail) . "',\n\t\t\tPv='" . $mysql->escape($this->Pv) . "',\n\t\t\tUv='" . $mysql->escape($this->Uv) . "',\n\t\t\tFans='" . $mysql->escape($this->Fans) . "',\n\t\t\tSummary='" . $mysql->escape($this->Summary) . "',\n\t\t\tUrl='" . $mysql->escape($this->Url) . "',\n\t\t\tQrCode='" . $mysql->escape($this->QrCode) . "',\n\t\t\tLaud=" . intval($this->Laud) . "\n\t\t\t WHERE Id=" . intval($this->Id);
//echo $sql;
$mysql->runSql($sql);
$result = $mysql->affectedRows();
$mysql->closeDb();
return $result;
}