當前位置: 首頁>>代碼示例>>PHP>>正文


PHP table_class::update_attributes方法代碼示例

本文整理匯總了PHP中table_class::update_attributes方法的典型用法代碼示例。如果您正苦於以下問題:PHP table_class::update_attributes方法的具體用法?PHP table_class::update_attributes怎麽用?PHP table_class::update_attributes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在table_class的用法示例。


在下文中一共展示了table_class::update_attributes方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: redirect

		<meta http-equiv=Content-Language content=zh-CN>
		<title>福布斯中文網</title>
		<?php 
include "../../frame.php";
?>
	</head>
	<body>
		<?php 
$user = new table_class($tb_user);
if ($_POST['id'] != '0') {
    $user->find($_POST['id']);
    if ($user->name != $_POST['post']['name']) {
        $db = get_db();
        $record = $db->query("select * from " . $tb_user . " where name='" . $_POST['post']['name'] . "'");
        if (count($record) == 0) {
            if ($user->update_attributes($_POST['post'])) {
                redirect('user_list.php');
            } else {
                display_error('修改用戶失敗');
                echo '<a href="user_list.php">返回</a>';
            }
        } else {
            alert("您注冊的用戶名已經存在,請重新注冊!");
            redirect($_SERVER['HTTP_REFERER']);
        }
    } else {
        if ($_FILES['image_src']['name'] != '') {
            $upload = new upload_file_class();
            $upload->save_dir = '/upload/news/';
            $user->image_src = '/upload/news/' . $upload->handle('image_src', 'filter_pic');
            $changed = true;
開發者ID:sauger,項目名稱:forbes,代碼行數:31,代碼來源:user.post.php

示例2: intval

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv=Content-Type content="text/html; charset=utf-8">
	<meta http-equiv=Content-Language content=zh-CN>
	<title>forbes</title>
	<?php 
require_once '../../frame.php';
?>
</head>
<?php 
require_once '../../frame.php';
#var_dump($_POST);
$magazine = new table_class("fb_old_magazine");
$id = intval($_POST['id']);
if ($id != '') {
    $magazine->find($id);
}
$magazine->update_attributes($_POST['post']);
redirect('old_magazine_index.php');
開發者ID:sauger,項目名稱:forbes_old,代碼行數:20,代碼來源:old_magazine_edit.post.php

示例3: alert

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv=Content-Type content="text/html; charset=utf-8">
	<meta http-equiv=Content-Language content=zh-CN>
</head>
<?php 
require "../../frame.php";
$id = $_POST['id'];
$city = new table_class('fb_city');
if ($id != '') {
    $city->find($id);
}
if ($_FILES['city_photo']['name'] != null) {
    $upload = new upload_file_class();
    $upload->save_dir = "/upload/city/";
    $img = $upload->handle('city_photo', 'filter_pic');
    if ($img === false) {
        alert('上傳文件失敗 !');
        redirect($_SERVER['HTTP_REFERER']);
    }
    $city->photo = "/upload/city/{$img}";
}
if (!$city->update_attributes($_POST['city'])) {
    alert('城市已存在或執行錯誤!');
    redirect($_SERVER['HTTP_REFERER']);
}
redirect('index.php');
?>
</html>
開發者ID:sauger,項目名稱:forbes_old,代碼行數:30,代碼來源:edit.post.php

示例4: alert

<?php

require_once "../frame.php";
var_dump($_POST);
$upload = new upload_file_class();
$employ = new table_class("hoau_employ");
if ($_FILES['url']['name'] != '') {
    $upload->save_dir = "/upload/employ/";
    $em = $upload->handle('url');
    if ($em === false) {
        alert('上傳失敗 !');
        redirect($_SERVER['HTTP_REFERER']);
    }
    $employ->url = "/upload/employ/" . $em;
}
$employ->id_read = 0;
$employ->date = date("Y-m-d H:i:s");
$employ->update_attributes($_POST['post']);
redirect($_POST['url']);
開發者ID:justin1986,項目名稱:hoau,代碼行數:19,代碼來源:test_employ.post.php

示例5: alert

    $upload = new upload_file_class();
    $upload->save_dir = '/upload/images/';
    $img = $upload->handle('image', 'filter_pic');
    if ($img === false) {
        alert('上傳文件失敗 !');
        ?>
				<script>
					parent.remove_tb2();
				</script>
				<?php 
        die;
    }
    $vote->photo_url = "/upload/images/" . $img;
}
//如果投票上傳圖片,做處理
$vote->update_attributes($_POST['vote'], false);
$vote->save();
$count = count($_POST['vote_item']['title']);
$old_count = count($_POST['old_item']['title']);
$item = new table_class("fb_vote_item");
if ($_POST['vote']['vote_type'] == 'image_vote') {
    $upload = new upload_file_class();
    $upload->save_dir = '/upload/images/';
    $img = $upload->handle('vote_item', 'filter_pic');
    $old_img = $upload->handle('old_item', 'filter_pic');
}
for ($i = 0; $i < $count; $i++) {
    $item->id = 0;
    $item->vote_id = $vote->id;
    if ($_POST['vote']['vote_type'] == 'image_vote') {
        if ($img[$i]['result']) {
開發者ID:sauger,項目名稱:forbes,代碼行數:31,代碼來源:ajax.post.php

示例6: intval

include "../../frame.php";
?>
	</head>
	<body>
		<?php 
$image = new table_class('fb_magazine_image');
$id = intval($_POST['id']);
if ($id != '') {
    $image->find($id);
} else {
    $image->created_at = date("Y-m-d H:i:s");
}
//var_dump($_POST);
if ($_FILES['image']['name'] != null) {
    $upload = new upload_file_class();
    $upload->save_dir = "/upload/images/";
    $img = $upload->handle('image', 'filter_pic');
    if ($img === false) {
        alert('上傳文件失敗 !');
        redirect($_SERVER['HTTP_REFERER']);
    }
    $image->src = "/upload/images/{$img}";
}
if ($_POST['image']["priority"] == null) {
    $image->update_attribute("priority", "100");
}
$image->update_attributes($_POST['image']);
redirect('img_list.php?id=' . $image->magazine_id);
?>
	</body>
</html>
開發者ID:sauger,項目名稱:forbes_old,代碼行數:31,代碼來源:image.post.php

示例7: alert

<?php

require "../../frame.php";
$id = $_POST['id'];
$f_mrb = new table_class('fb_fhb');
if ($id != '') {
    $f_mrb->find($id);
}
$f_mrb->update_attributes($_POST['fhb'], false);
if ($_FILES['image_src']['name'] != '') {
    $upload = new upload_file_class();
    $upload->save_dir = '/upload/news/';
    if (!($upload_name = $upload->handle('image_src', 'filter_pic'))) {
        alert('上傳圖片失敗!');
        redirect($_SERVER['HTTP_REFERER']);
        die;
    }
    $f_mrb->image_src = '/upload/news/' . $upload_name;
}
$f_mrb->save();
redirect('index.php');
開發者ID:sauger,項目名稱:forbes_old,代碼行數:21,代碼來源:bdedit.post.php

示例8: intval

<?php

include '../../frame.php';
$table = new table_class('fb_filte_words');
$id = intval($_POST['id']);
if ($id) {
    $table->find($id);
}
$table->update_attributes($_POST['post']);
redirect('list.php');
開發者ID:sauger,項目名稱:forbes_old,代碼行數:10,代碼來源:post.php

示例9:

<?php

include_once "../../frame.php";
use_jquery();
js_include_tag('jquery.colorbox-min');
$pos = new table_class('eb_page_pos');
$pos->find_by_name($_POST[pos][name]);
$pos->update_file_attributes('pos');
$pos->update_attributes($_POST['pos'], false);
$pos->save();
?>
<script>
	parent.$.fn.colorbox.close();
	parent.frames['admin_iframe'].location.reload();
</script>
開發者ID:justin1986,項目名稱:eachbb,代碼行數:15,代碼來源:edit.post.php

示例10: alert

}
if (empty($_FILES)) {
    alert("上傳的文件太大!");
    redirect('edit.php');
    die;
}
if ($_FILES['image'][name]) {
    $upload = new upload_file_class();
    $upload->save_dir = '/upload/images/';
    $img = $upload->handle('image', 'filter_pic');
    if ($img === false) {
        alert('上傳圖片失敗 !');
        redirect('edit.php');
        die;
    }
    $teach->img_url = "/upload/images/" . $img;
}
if ($_FILES['flash'][name]) {
    $upload = new upload_file_class();
    $upload->save_dir = '/upload/flash/';
    $flash = $upload->handle('flash');
    if ($flash === false) {
        alert('上傳flash失敗 !');
        redirect('edit.php');
        die;
    }
    $teach->content = "/upload/flash/" . $flash;
}
$teach->update_attributes($_POST['post'], false);
$teach->save();
redirect('index.php');
開發者ID:justin1986,項目名稱:eachbb,代碼行數:31,代碼來源:edit.post.php

示例11: intval

<?php

include '../../frame.php';
$post_type = intval($_POST['mlist']['list_type']);
$id = intval($_POST['id']);
$list_type = new table_class('fb_custom_list_type');
if ($id) {
    $list_type->find($id);
}
$list_type->update_attributes($_POST['mlist'], false);
$list_type->table_name = 'fb_picture_list_items';
if ($_FILES['image_src']['name'] != '') {
    $upload = new upload_file_class();
    $upload->save_dir = '/upload/news/';
    if (!($upload_name = $upload->handle('image_src', 'filter_pic'))) {
        alert('上傳圖片失敗!');
        redirect($_SERVER['HTTP_REFERER']);
        die;
    }
    $list_type->image_src = '/upload/news/' . $upload_name;
}
$list_type->save();
redirect('picture_list_list.php');
開發者ID:sauger,項目名稱:forbes_old,代碼行數:23,代碼來源:picture_list_edit.post.php

示例12: elseif

        if ($right->id) {
            $db->execute("delete from fb_role_rights where rights_id = {$right->id}");
            $right->delete();
        }
    }
    if (isset($_POST['rela'])) {
        $db = get_db();
        $db->execute("delete from fb_position_relation where type='{$_POST['rela']}' and news_id={$_POST['del_id']}");
    }
    $post->delete($_POST['del_id']);
    echo $_POST['del_id'];
} elseif ("edit" == $_POST['post_type']) {
    if ($_POST['id'] != '') {
        $post->find($_POST['id']);
    }
    $post->update_attributes($_POST['post']);
    redirect($_POST['url']);
} elseif ("edit_priority" == $_POST['post_type']) {
    $id_str = explode("|", $_POST['id_str']);
    $priority_str = explode("|", $_POST['priority_str']);
    $id_str_num = sizeof($id_str) - 1;
    if ($_POST['is_dept_list'] == 'true') {
        $priority = 'dept_priority';
    } else {
        $priority = 'priority';
    }
    for ($i = $id_str_num - 1; $i >= 0; $i--) {
        if ($priority_str[$i] == "") {
            $priority_str[$i] = "100";
        }
        $db = get_db();
開發者ID:sauger,項目名稱:forbes,代碼行數:31,代碼來源:pub.post.php

示例13: intval

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv=Content-Type content="text/html; charset=utf-8">
	<meta http-equiv=Content-Language content=zh-CN>
	<title>forbes</title>
	<?php 
require_once '../../frame.php';
?>
</head>
<?php 
require_once '../../frame.php';
#var_dump($_POST);
$survey = new table_class("fb_survey");
$id = intval($_POST['id']);
if ($id != '') {
    $survey->find($id);
}
$survey->update_attributes($_POST['post'], false);
$survey->update_file_attributes('post');
$survey->save();
redirect('index.php');
開發者ID:sauger,項目名稱:forbes_old,代碼行數:22,代碼來源:edit.post.php

示例14:

<?php

#var_dump($_POST);
require "../../frame.php";
$module = new table_class('fb_subject_modules');
$module->update_attributes($_POST['module'], false);
$module->id = $_POST['id'];
if ($module->save()) {
    echo 'ok';
} else {
    echo 'fail';
}
開發者ID:sauger,項目名稱:forbes,代碼行數:12,代碼來源:subject_module.post.php

示例15: intval

<?php

session_start();
include_once '../../frame.php';
$role = judge_role();
$yh_id = intval($_POST['id']);
$db = get_db();
$info = $db->query("select id from fb_yh_xx where yh_id={$yh_id}");
if ($db->record_count == 1) {
    $id = $info[0]->id;
} else {
    $id = 0;
}
$info = new table_class('fb_yh_xx');
if ($id != 0) {
    $info->find($id);
}
$info->update_attributes($_POST['info'], false);
if ($_FILES['tx']['name'] != null) {
    $upload = new upload_file_class();
    $upload->save_dir = "/upload/user/";
    $img = $upload->handle('tx', 'filter_pic');
    if ($img === false) {
        alert('上傳文件失敗 !');
        redirect($_SERVER['HTTP_REFERER']);
    }
    $info->tx = "/upload/user/{$img}";
}
$info->yh_id = $yh_id;
$info->save();
redirect('index.php');
開發者ID:sauger,項目名稱:forbes,代碼行數:31,代碼來源:edit_info.post.php


注:本文中的table_class::update_attributes方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。