本文整理汇总了PHP中DataBase::mysql_prep方法的典型用法代码示例。如果您正苦于以下问题:PHP DataBase::mysql_prep方法的具体用法?PHP DataBase::mysql_prep怎么用?PHP DataBase::mysql_prep使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataBase
的用法示例。
在下文中一共展示了DataBase::mysql_prep方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_data_table_all
public function get_data_table_all($mark, $model = 0)
{
$db = DataBase::getDB();
// Создаём объект базы данных
//Если выбрана марка и модель то подгружаем и марку и модель иначе марку
if ($model) {
$query = "SELECT ddl_id, ddl_mark, ddl_mark_title, ddl_model, ddl_model_title, ddl_type_engine, ddl_transmission, ddl_volume_cars, ddl_year_from, ddl_year_to, ddl_name_engine, ddl_price FROM `dvigateli_dlya_legkovyh` WHERE `ddl_mark` = '" . DataBase::mysql_prep($mark) . "' AND `ddl_model` = '" . DataBase::mysql_prep($model) . "'";
} else {
$query = "SELECT ddl_id, ddl_mark, ddl_mark_title, ddl_model, ddl_model_title, ddl_type_engine, ddl_transmission, ddl_volume_cars, ddl_year_from, ddl_year_to, ddl_name_engine, ddl_price FROM `dvigateli_dlya_legkovyh` WHERE `ddl_mark` = '" . DataBase::mysql_prep($mark) . "' GROUP BY ddl_model";
}
$reply = $db->select($query);
return $reply;
}
示例2: get_data_table_all
public function get_data_table_all($mark, $number_view = 'all')
{
$db = DataBase::getDB();
// Создаём объект базы данных
//Проверяем показывать все модели или первые 20
if ($number_view === 'all') {
$query = "SELECT kdg_id, kdg_mark, kdg_mark_title, kdg_model, kdg_model_title, kdg_year, kdg_price, kdg_images, kdg_show FROM `kabiny_dlya_gruzovyh` WHERE `kdg_mark` = '" . DataBase::mysql_prep($mark) . "'";
} else {
$query = "SELECT kdg_id, kdg_mark, kdg_mark_title, kdg_model, kdg_model_title, kdg_year, kdg_price, kdg_images, kdg_show FROM `kabiny_dlya_gruzovyh` WHERE `kdg_mark` = '" . DataBase::mysql_prep($mark) . "' GROUP BY kdg_model LIMIT " . DataBase::mysql_prep($number_view);
}
$reply = $db->select($query);
return $reply;
}
示例3: get_data_table_all
public function get_data_table_all($mark, $number_view = 'all')
{
$db = DataBase::getDB();
// Создаём объект базы данных
//Проверяем показывать все моделт или первые 20
if ($number_view === 'all') {
$query = "SELECT ddl_id, ddl_mark, ddl_mark_title, ddl_model, ddl_model_title, ddl_type_engine, ddl_transmission, ddl_volume_cars, ddl_year_from, ddl_year_to, ddl_name_engine, ddl_price FROM `dvigateli_dlya_legkovyh` WHERE `ddl_mark` = '" . DataBase::mysql_prep($mark) . "'";
} else {
$query = "SELECT ddl_id, ddl_mark, ddl_mark_title, ddl_model, ddl_model_title, ddl_type_engine, ddl_transmission, ddl_volume_cars, ddl_year_from, ddl_year_to, ddl_name_engine, ddl_price FROM `dvigateli_dlya_legkovyh` WHERE `ddl_mark` = '" . DataBase::mysql_prep($mark) . "' GROUP BY ddl_model LIMIT " . DataBase::mysql_prep($number_view);
}
$reply = $db->select($query);
return $reply;
}
示例4: get_data
public function get_data($filter_page, $filter)
{
switch ($filter_page) {
case 'dvigateli_dlya_legkovyh':
if ($filter) {
//Перебором подставляем все данные которые были выбраны
foreach ($filter as $filter_key => $filter_value) {
if (!empty($filter_value)) {
if (!isset($filter_query)) {
if ($filter_key == "ddl_year") {
$filter_query = " ('" . DataBase::mysql_prep($filter_value) . "' >= ddl_year_from AND '" . DataBase::mysql_prep($filter_value) . "' <= ddl_year_to)";
} else {
$filter_query = "`" . DataBase::mysql_prep($filter_key) . "` = '" . DataBase::mysql_prep($filter_value) . "'";
}
} else {
if ($filter_key == "ddl_year") {
$filter_query .= " AND ('" . $filter_value . "' >= ddl_year_from AND '" . $filter_value . "' <= ddl_year_to)";
} else {
$filter_query .= " AND `" . DataBase::mysql_prep($filter_key) . "` = '" . DataBase::mysql_prep($filter_value) . "'";
}
}
}
}
//Делаем запрос для фильтра
$db = DataBase::getDB();
// Создаём объект базы данных
$query = "SELECT ddl_model, ddl_model_title, ddl_type_engine, ddl_transmission, ddl_volume_cars, ddl_year_from, ddl_year_to FROM `" . DataBase::mysql_prep($filter_page) . "` WHERE " . $filter_query . " ORDER BY ddl_model, ddl_volume_cars, ddl_year_from";
$reply['data_selection'] = $db->select($query);
//Делаем запрос для таблицы
$db = DataBase::getDB();
// Создаём объект базы данных
$query = "SELECT ddl_id, ddl_mark, ddl_mark_title, ddl_model, ddl_model_title, ddl_type_engine, ddl_transmission, ddl_volume_cars, ddl_year_from, ddl_year_to, ddl_name_engine, ddl_price FROM `" . DataBase::mysql_prep($filter_page) . "` WHERE " . $filter_query . " ORDER BY ddl_model, ddl_volume_cars, ddl_year_from";
//echo $query;
$reply['data_table'] = $db->select($query);
//Если пустая выдача
if (empty($reply['data_table']) || empty($reply['data_selection'])) {
unset($reply['data_table']);
unset($reply['data_selection']);
return false;
} else {
return $reply;
}
} else {
return false;
}
break;
case 'kpp_dlya_legkovyh':
if ($filter) {
//Перебором подставляем все данные которые были выбраны
foreach ($filter as $filter_key => $filter_value) {
if (!empty($filter_value)) {
if (!isset($filter_query)) {
if ($filter_key == "kdl_year") {
$filter_query = " ('" . DataBase::mysql_prep($filter_value) . "' >= kdl_year_from AND '" . DataBase::mysql_prep($filter_value) . "' <= kdl_year_to)";
} else {
$filter_query = "`" . DataBase::mysql_prep($filter_key) . "` = '" . DataBase::mysql_prep($filter_value) . "'";
}
} else {
if ($filter_key == "kdl_year") {
$filter_query .= " AND ('" . DataBase::mysql_prep($filter_value) . "' >= kdl_year_from AND '" . DataBase::mysql_prep($filter_value) . "' <= kdl_year_to)";
} else {
$filter_query .= " AND `" . DataBase::mysql_prep($filter_key) . "` = '" . DataBase::mysql_prep($filter_value) . "'";
}
}
}
}
//Делаем запрос для фильтра
$db = DataBase::getDB();
// Создаём объект базы данных
$query = "SELECT kdl_model, kdl_model_title, kdl_type_engine, kdl_transmission, kdl_volume_cars, kdl_year_from, kdl_year_to FROM `" . DataBase::mysql_prep($filter_page) . "` WHERE " . $filter_query . " ORDER BY kdl_model, kdl_volume_cars, kdl_year_from";
$reply['data_selection'] = $db->select($query);
//Делаем запрос для таблицы
$db = DataBase::getDB();
// Создаём объект базы данных
$query = "SELECT kdl_id, kdl_mark, kdl_mark_title, kdl_model, kdl_model_title, kdl_type_engine, kdl_transmission, kdl_volume_cars, kdl_year_from, kdl_year_to, kdl_name_engine, kdl_price FROM `" . DataBase::mysql_prep($filter_page) . "` WHERE " . $filter_query . " ORDER BY kdl_model, kdl_volume_cars, kdl_year_from";
$reply['data_table'] = $db->select($query);
//Если пустая выдача
if (empty($reply['data_table']) || empty($reply['data_selection'])) {
unset($reply['data_table']);
unset($reply['data_selection']);
return false;
} else {
return $reply;
}
} else {
return false;
}
break;
case 'dvigateli_dlya_gruzovyh':
if ($filter) {
//Перебором подставляем все данные которые были выбраны
foreach ($filter as $filter_key => $filter_value) {
if (!empty($filter_value)) {
if (!isset($filter_query)) {
if ($filter_key == "ddg_year") {
$filter_query = " ('" . DataBase::mysql_prep($filter_value) . "' >= ddg_year_from AND '" . DataBase::mysql_prep($filter_value) . "' <= ddg_year_to)";
} else {
$filter_query = "`" . DataBase::mysql_prep($filter_key) . "` = '" . DataBase::mysql_prep($filter_value) . "'";
}
} else {
//.........这里部分代码省略.........