本文整理匯總了PHP中Main::escape方法的典型用法代碼示例。如果您正苦於以下問題:PHP Main::escape方法的具體用法?PHP Main::escape怎麽用?PHP Main::escape使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Main
的用法示例。
在下文中一共展示了Main::escape方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
function __construct($data, $table, $cond)
{
if (Main::$con == FALSE) {
Main::openConnection();
$this->newCon = TRUE;
}
$data = Main::escape($data);
$query = Main::generateQuery('UPDATE', $data, $table, $cond);
mysql_query($query) or Main::throwException('Internal Error Occured', 0, 'Query Failed' . mysql_error());
//Main::displaySuccess('DataBase Updated Successfully');
}
示例2: getDetailsContains
function getDetailsContains($table, $data = '*', $cond)
{
if (Main::$con == FALSE) {
Main::openConnection();
$this->newCon = TRUE;
}
$data = Main::escape($data);
$query = "SELECT ";
if (is_array($data)) {
$i = 0;
foreach ($data as $value) {
if ($i < 1) {
$query .= "`{$value}`";
} else {
$query .= ",`{$value}`";
}
$i++;
}
} else {
if ($query == '*') {
$query .= '*';
} else {
$query .= "`{$data}`";
}
}
$query .= " FROM `{$table}`";
$query .= " WHERE ";
$i = 0;
foreach ($cond as $key => $value) {
if ($i < 1) {
$query .= "`{$key}` LIKE '%{$value}%'";
} else {
$query .= "AND `{$key}` LIKE '%{$value}%'";
}
$i++;
}
$result = mysql_query($query) or die('Query Failed' . mysql_error());
if (mysql_num_rows($result) > 0) {
while ($row = mysql_fetch_assoc($result)) {
$data[] = $row;
}
return $data;
} else {
return array();
}
}