Example #1
0
function userFollowUpdate($user_code, $follow_type, $follow_code, $update_type)
{
    // 生成动态目标表名
    $table = constant('TB_BAS_USER_FOLLOW_' . strtoupper($follow_type));
    // 必须用户编码和对象编码都有效才能执行更新操作
    if ($user_code && $follow_code) {
        // 根据不同的更新类型执行不同的操作
        switch ($update_type) {
            case 'add':
                if (!userFollowQuery($follow_type, 'count', array('user_code' => $user_code, 'follow_code' => $follow_code))) {
                    $data = array('user_code' => $user_code, 'follow_code' => $follow_code, 'follow_time' => date('Y-m-d H:i:s'), 'follow_state' => 1);
                    $flag = insertTable($table, $data);
                } else {
                    $flag = 1;
                }
                break;
            case 'del':
                $condition = array('user_code' => $user_code, 'follow_code' => $follow_code);
                $flag = deleteTable($table, $condition);
                break;
        }
    } else {
        return false;
    }
    return $flag;
    // // 更新完成返回最新的关注/收藏查询数据
    // if($flag){
    //     return userFollowQuery($follow_type , 'count', array('user_code'=>$user_code)) ;
    // }else{
    //     return false ;
    // }
}
<?php

include_once 'rnfunctions.php';
deleteTable('rnMessages');
Example #3
0
    die;
}
if (isset($_POST['edit'])) {
    if (editTable()) {
        $path = sprintf('location: ' . HTTP_PATH . 'public/views/%s.php', $_POST['page']);
        unset($_POST['edit']);
        header($path);
        die;
    } else {
        echo 'something went wrong!';
    }
}
if (isset($view)) {
    switch ($view) {
        case 'delete':
            if (deleteTable()) {
                $path = sprintf('location: ' . HTTP_PATH . 'public/views/%s.php', $_POST['page']);
                header($path);
            }
            break;
        case 'edit':
            $list = getItemData($page, $_POST['id']);
            break;
        case 'list':
        case 'add':
            $list = getTableData($page);
            break;
    }
}
//returns a list of all filled rows in the specific table
function getTableData($page)
Example #4
0
 }
 // display the tables on screen so we can see they were created
 echo "<h2>Showing script-created tables</h2>";
 if ($tables = getTableList($connection, $config["db"]["name"])) {
     foreach ($tables as $id => $table) {
         printTable($connection, $table);
     }
 }
 //
 // export and kill database
 //
 // dump this database to a file
 exportDB($connection, $config["db"]["name"], $config["db"]["backupFile"]);
 // remove the tables we just created
 foreach ($db_schema as $table => $keys) {
     $tableResult = deleteTable($connection, $table);
     // if there's an error, show it
     if ($tableResult) {
         echo $tableResult;
     }
 }
 // display the tables on screen so we can see they were dumped
 echo "<h2>Showing tables after database export and table dump</h2>";
 if ($tables = getTableList($connection, $config["db"]["name"])) {
     foreach ($tables as $id => $table) {
         printTable($connection, $table);
     }
 } else {
     echo "<br><br>No tables found.<br><br>";
 }
 //