当前位置: 首页>>代码示例>>PHP>>正文


PHP db::runsql方法代码示例

本文整理汇总了PHP中db::runsql方法的典型用法代码示例。如果您正苦于以下问题:PHP db::runsql方法的具体用法?PHP db::runsql怎么用?PHP db::runsql使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在db的用法示例。


在下文中一共展示了db::runsql方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: session_validate

function session_validate($session_type)
{
    require_once '../classes/db.class.php';
    $conn = new db();
    $dbcon = $conn->dbConnect();
    $i = 0;
    $sql = "SELECT team_id FROM amz_teams";
    $result = $conn->runsql($sql, $dbcon);
    while ($result_row = mysqli_fetch_object($result)) {
        $user_team_id[] = $result_row->team_id;
        $i++;
    }
    if ($session_type == "sda") {
        define("USER_ID", $_SESSION['sda_id'], TRUE);
        define("USER_NAME", $_SESSION['sda_name'], TRUE);
        define("USER_FIRST_NAME", $_SESSION['sda_first_name'], TRUE);
        define("USER_MAIL", $_SESSION['sda_mail'], TRUE);
        define("USER_TEAMS", json_encode($_SESSION['team_id']), TRUE);
        define("USER_TOT_TEAMS", $_SESSION['sda_team_count'], TRUE);
    } elseif ($session_type == "manager") {
        define("USER_ID", $_SESSION['manager_id'], TRUE);
        define("USER_NAME", $_SESSION['manager_name'], TRUE);
        define("USER_FIRST_NAME", $_SESSION['manager_first_name'], TRUE);
        define("USER_MAIL", $_SESSION['manager_mail'], TRUE);
        define("USER_TEAMS", json_encode($_SESSION['team_id']), TRUE);
        define("USER_TOT_TEAMS", $_SESSION['manager_team_count'], TRUE);
    } elseif ($session_type == "admin") {
        define("USER_ID", $_SESSION['admin_id'], TRUE);
        define("USER_NAME", $_SESSION['admin_name'], TRUE);
        define("USER_FIRST_NAME", $_SESSION['admin_first_name'], TRUE);
        define("USER_MAIL", $_SESSION['admin_mail'], TRUE);
        define("USER_TEAMS", json_encode($user_team_id), TRUE);
        define("USER_TOT_TEAMS", $i, TRUE);
    } else {
        header("location:../");
    }
}
开发者ID:asdhanapal,项目名称:dashboard_test_1,代码行数:37,代码来源:session.php

示例2: db

require_once '../classes/db.class.php';
$conn = new db();
$host_name = $_SERVER['REMOTE_ADDR'];
//gethostbyaddr($_SERVER['REMOTE_ADDR']);
$dbcon = $conn->dbConnect();
session_start();
$fail_msg = $success_msg = '';
//print_r($_POST);
if (isset($_GET) && $_POST['uname'] != "") {
    $uname = $_POST['uname'];
    $team = explode(",", $_POST['teams']);
    $team_count = sizeof($team);
    $gepassword = gen_md5_password(8);
    $password = md5($gepassword);
    $query = "SELECT * FROM amz_login WHERE user_name='{$uname}'";
    $result = $conn->runsql($query, $dbcon);
    if (mysqli_num_rows($result)) {
        $result_row = mysqli_fetch_object($result);
        if ($result_row->user_deletion == '0') {
            $fail_msg = "Username already exist!";
        } else {
            if ($result_row->user_deletion == '1') {
                $user_mail = $uname . "@amazon.com";
                $query_update_user = "UPDATE amz_login SET password='{$password}', user_type=1, user_deletion='0',team_count='{$team_count}', user_status=0, user_activation=0 WHERE user_name='{$uname}'";
                $result_update = $conn->runsql($query_update_user, $dbcon);
                if ($result_update) {
                    $success_msg = "User request sent.";
                    $query_insert_user_teams = "SELECT user_id FROM amz_login WHERE user_name='{$uname}'";
                    $result_insert_user_teams = $conn->runsql($query_insert_user_teams, $dbcon);
                    $result_row_insert_user_teams = mysqli_fetch_object($result_insert_user_teams);
                    $user_id = $result_row_insert_user_teams->user_id;
开发者ID:asdhanapal,项目名称:dashboard_test_1,代码行数:31,代码来源:do_reg.php

示例3: array

$year = $_POST['year'];
if ($year == "") {
    ?>
    <div style="text-align: center;">Select the year!</div>
    <?php 
    die;
}
$month_array = array(1 => "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
?>
    <table width="100%" class="my_table">
    <tr class="tbl_header">
    <td colspan="25" align="center">Bandwidth Utilization</td>
    </tr>
    <?php 
$query_1 = "SELECT team_id,team_name FROM amz_teams ORDER BY team_name ASC";
$result_1 = $conn->runsql($query_1, $dbcon);
if (mysqli_num_rows($result_1)) {
    while ($result_row_1 = mysqli_fetch_object($result_1)) {
        ?>
        <tr class="head_row" style="background-color: #EBEBEB;" onclick="view_report_2_get_full_info(<?php 
        echo $result_row_1->team_id;
        ?>
);" id="master_row_<?php 
        echo $result_row_1->team_id;
        ?>
">
            <td colspan="25">
                <?php 
        echo $result_row_1->team_name;
        ?>
            </td>
开发者ID:asdhanapal,项目名称:dashboard_test_1,代码行数:31,代码来源:yearly_view_bw_data_1_1.php

示例4: db

<?php

require_once '../classes/db.class.php';
$conn = new db();
$dbcon = $conn->dbConnect();
if (isset($_GET['action'])) {
    $id = $_POST['id'];
    $sql1 = "DELETE FROM user_tasks WHERE task_id = '{$id}'";
    $result1 = $conn->runsql($sql1, $dbcon);
    if ($result1) {
        echo "<font color='green'>Task deleted Successfully</font>";
    } else {
        echo "<font color='red'>Something went wrong!</font>";
    }
}
开发者ID:asdhanapal,项目名称:dashboard_test_1,代码行数:15,代码来源:del_user_entries.php

示例5: db

<?php 
//
session_start();
include_once '../sda/data_page.php';
require_once '../classes/db.class.php';
$conn = new db();
$dbcon = $conn->dbConnect();
$rows = array();
//flag is not needed
$flag = true;
$table = array();
$table['cols'] = array(array('label' => 'Weekly Task', 'type' => 'string'), array('label' => 'Percentage', 'type' => 'number'));
$rows = array();
$query_2 = "SELECT time,count,wu FROM user_tasks limit 1,10";
$result_2 = $conn->runsql($query_2, $dbcon);
while ($result_row_2 = mysqli_fetch_object($result_2)) {
    $temp = array();
    // the following line will be used to slice the Pie chart
    $temp[] = array('v' => (string) $result_row_2->count);
    // Values of each slice
    $temp[] = array('v' => (int) $result_row_2->wu);
    $rows[] = array('c' => $temp);
}
$table['rows'] = $rows;
print_r($table);
$jsonTable = json_encode($table);
//echo $jsonTable;
?>

<html>
开发者ID:asdhanapal,项目名称:dashboard_test_1,代码行数:30,代码来源:dynamic_back.php

示例6: db

require_once _BACK_TO_PRE_ . DB_CLASS . DB_CLASS_FILE;
$conn = new db();
$dbcon = $conn->dbConnect();
$editing_id = $_POST['editing_id'];
$p_team = $_POST['p_team'];
$a_team = $_POST['a_team'];
$p_team_array = explode(",", $p_team);
$a_team_array = explode(",", $a_team);
if (array_diff($p_team_array, $a_team_array)) {
    $result[0] = "F";
    $result[1] = "Parent team should be present in available team!";
    echo json_encode($result);
    exit;
}
$query_p_team = "DELETE FROM amz_pteam_info WHERE user_id='{$editing_id}'";
$result_p_team = $conn->runsql($query_p_team, $dbcon);
if ($result_p_team) {
    for ($i = 0; $i < sizeof($p_team_array); $i++) {
        $query_p_team_insert = "INSERT INTO amz_pteam_info(user_id,team_id,start_date) VALUES ('{$editing_id}','{$p_team_array[$i]}',now())";
        $conn->runsql($query_p_team_insert, $dbcon);
    }
}
$query_a_team = "DELETE FROM amz_user_info WHERE user_id='{$editing_id}'";
$result_a_team = $conn->runsql($query_a_team, $dbcon);
if ($result_a_team) {
    for ($i = 0; $i < sizeof($a_team_array); $i++) {
        $query_a_team_insert = "INSERT INTO amz_user_info(user_id,team_id) VALUES ('{$editing_id}','{$a_team_array[$i]}')";
        $conn->runsql($query_a_team_insert, $dbcon);
    }
}
if ($result_a_team && $result_p_team) {
开发者ID:asdhanapal,项目名称:dashboard_test_1,代码行数:31,代码来源:update_user_details.php

示例7: get_teams

function get_teams($user_id, $team_array)
{
    require_once '../classes/db.class.php';
    $conn = new db();
    $dbcon = $conn->dbConnect();
    $teams = "";
    $query = "SELECT team_id FROM amz_user_info WHERE user_id='{$user_id}' AND status='1'";
    $result = $conn->runsql($query, $dbcon);
    $i = 1;
    if (mysqli_num_rows($result)) {
        while ($result_row = mysqli_fetch_object($result)) {
            $teams .= $team_array[$result_row->team_id] . ", ";
        }
        return rtrim($teams, ", ");
    } else {
        return "No teams available";
    }
}
开发者ID:asdhanapal,项目名称:dashboard_test_1,代码行数:18,代码来源:load_user_details.php

示例8: db

//include_once './data_page.php';
//print_r($_GET);
//print_r($_SESSION);
die("<center>Under maintenance!");
require_once '../classes/db.class.php';
$conn = new db();
$dbcon = $conn->dbConnect();
session_start();
$edited_by = $_SESSION['admin_id'];
$subject = $_GET['subject'];
$edit_item = $_GET['val'];
switch ($subject) {
    case "team":
        //echo "team edit".$edit_item;
        $query_team_edit_select = "SELECT team_id,team_name FROM amz_teams WHERE team_id='{$edit_item}'";
        $result_1 = $conn->runsql($query_team_edit_select, $dbcon);
        $result_row_1 = mysqli_fetch_object($result_1);
        ?>
        
          <form >
            <div class="row">
                
                <div class="small-12 columns"><center><span id="final_msg"></span></center></div>
                <div class="small-12 columns">
                    <div class="row">
                        <div class="small-3 columns"><label class="left inline">Team name: </label></div>
                        <div class="row collapse">
                            <div class="small-7 columns">
                                <input type="text" placeholder="Team name" value="<?php 
        echo $result_row_1->team_name;
        ?>
开发者ID:asdhanapal,项目名称:dashboard_test_1,代码行数:31,代码来源:edit_data.php

示例9: db

<?php

require_once '../classes/db.class.php';
$conn = new db();
$dbcon = $conn->dbConnect();
session_start();
$fail_msg = $success_msg = '';
if (isset($_GET) && $_POST['uname'] != "" && $_POST['pass'] != "") {
    $uname = $_POST['uname'];
    $pass = $_POST['pass'];
    $i = 0;
    $uname = mysqli_real_escape_string($dbcon, $uname);
    $pass = mysqli_real_escape_string($dbcon, $pass);
    $pass = md5($pass);
    $query = "SELECT * FROM amz_login WHERE user_name='{$uname}' AND user_deletion='0'";
    $result = $conn->runsql($query, $dbcon);
    if (mysqli_num_rows($result)) {
        $result_row = mysqli_fetch_object($result);
        if ($result_row->password == $pass) {
            if (!$result_row->user_activation) {
                $fail_msg = "<font color='red'>Your request not yet validated!</font>";
            } elseif (!$result_row->user_status) {
                $fail_msg = "<font color='red'>Your account was blocked!</font>";
            } else {
                if ($result_row->user_type == 1) {
                    $success_msg = 'U';
                    $_SESSION['session_type'] = "user";
                    $_SESSION['user_name'] = $uname;
                    //user's name
                    $_SESSION['user_id'] = $result_row->user_id;
                    //auto_incremented id
开发者ID:asdhanapal,项目名称:dashboard_test_1,代码行数:31,代码来源:check_login.php

示例10: while

            <tr id="data_header" align="center">
                <td >S.No.</td>
                <td>Team</td>
                <td>Time</td>
                <td>Count</td>
                <td>Work units</td>
            </tr></thead>
            <?php 
$i = 1;
$tot_time = "";
$tot_count = 0;
$secs = 0;
$tot_work_units = 0.0;
if ($team == "") {
    $query_unique_team_query = "SELECT DISTINCT team_id FROM user_tasks_ot WHERE " . $where_1 . " ORDER BY team_id ASC";
    $result_unique_team = $conn->runsql($query_unique_team_query, $dbcon);
    while ($result_row = mysqli_fetch_object($result_unique_team)) {
        $unique_team = $result_row->team_id;
        $query = "SELECT time,count,wu FROM user_tasks_ot WHERE team_id='{$unique_team}' AND " . $where_1;
        $result = $conn->runsql($query, $dbcon);
        while ($result_row = mysqli_fetch_object($result)) {
            $tot_count += $result_row->count;
            $secs += strtotime($result_row->time) - strtotime("00:00:00");
            $tot_work_units += $result_row->wu;
        }
        echo $i % 2 == 0 ? "<tr id='data_row_even' align=center>" : "<tr id='data_row_odd'  align=center>";
        ?>
                    <td><?php 
        echo $i++;
        ?>
</td>
开发者ID:asdhanapal,项目名称:dashboard_test_1,代码行数:31,代码来源:load_user_entries_2_ot.php

示例11: IN

    $task_query = " task_id IN ({$task}) AND ";
    $subtitle = "and task(s)";
} else {
    $task_query = "";
}
$where_1 = "team_id='{$team}' AND date BETWEEN '{$date_from}' AND '{$date_to}'";
if ($user != "null") {
    $where_1 .= " AND user_id IN ({$user}) ";
    $subtitle .= " and user(s)";
}
$output['result_status'] = "S";
$output['title'] = "Report between {$date_from} and {$date_to}";
$task_list = $actual_list = $target_list = $user_wu_tot = $daily_target_temp = $daily_target_temp_in_wu = $daily_target_temp_in_wu_in_per = $wu_avg = $tot_wu = $tot_time = "";
$max = 100;
$query_1 = "SELECT task_id,task_name,about_chart FROM amz_tasks WHERE team_id='{$team}' AND {$task_query} about_chart != 0 ORDER BY `task_name` ASC";
$result_1 = $conn->runsql($query_1, $dbcon);
while ($result_row_1 = mysqli_fetch_object($result_1)) {
    if ($result_row_1->about_chart == 1) {
        $task_id = $result_row_1->task_id;
        $tot_count = $tot_count_ot = 0;
        $secs = $secs_ot = 0;
        $tot_work_units = $tot_work_units_ot = 0.0;
        $query_2 = "SELECT time,count,wu FROM user_tasks WHERE tasks_id='{$task_id}' AND " . $where_1;
        $result_2 = $conn->runsql($query_2, $dbcon);
        while ($result_row_2 = mysqli_fetch_object($result_2)) {
            $tot_count += $result_row_2->count;
            $secs += strtotime($result_row_2->time) - strtotime("00:00:00");
            $tot_work_units += $result_row_2->wu;
        }
        $query_ot = "SELECT time,count,wu FROM user_tasks_ot WHERE tasks_id='{$task_id}' AND " . $where_1 . " AND ot_status='1'";
        $result_ot = $conn->runsql($query_ot, $dbcon);
开发者ID:asdhanapal,项目名称:dashboard_test_1,代码行数:31,代码来源:column_line.php

示例12: while

        <th>Feb</th>
        <th>Mar</th>
        <th>Apr</th>
        <th>May</th>
        <th>Jun</th>
        <th>Jul</th>
        <th>Aug</th>
        <th>Sep</th>
        <th>Oct</th>
        <th>Nov</th>
        <th>Dec</th>
    </tr>
   
    <?php 
    $sql = "SELECT DISTINCT sub_task_id FROM amz_dc_units WHERE month like '%{$years}%' AND task_id='{$task_id}'";
    $result = $conn->runsql($sql, $dbcon);
    if (mysqli_num_rows($result)) {
        while ($result_row = mysqli_fetch_object($result)) {
            $sub_task = $result_row->sub_task_id;
            echo "<tr><td>";
            echo "<b>" . $sub_task_array[$sub_task] . "</b>";
            echo "</td>";
            for ($i = 2; $i < 7; $i++) {
                ?>
                    <tr><td></td><td align="center"><?php 
                echo $i;
                ?>
</td>
                    <?php 
                for ($months = 1; $months <= 12; $months++) {
                    echo "<td>";
开发者ID:asdhanapal,项目名称:dashboard_test_1,代码行数:31,代码来源:manage_dc_yearly.php

示例13: substr

    <tr class="tbl_header">
    <td>Users\Month</td>
    <?php 
for ($i = 1; $i < sizeof($month_array); $i++) {
    echo "<td>" . substr($month_array[$i], 0, 3) . " Act</td>";
    echo "<td>" . substr($month_array[$i], 0, 3) . " Fcst</td>";
}
?>
    <td>Avg Act</td>
    </tr>
    <?php 
$secs = $secs_ot = 0;
$wu = $wu_ot = 0.0;
$daily_target = 0;
$query_1 = "SELECT team_id,team_name FROM amz_teams WHERE team_id='{$team}' ORDER BY team_name ASC";
$result_1 = $conn->runsql($query_1, $dbcon);
if (mysqli_num_rows($result_1)) {
    while ($result_row_1 = mysqli_fetch_object($result_1)) {
        $tr_color_decide_check = 0;
        $team_id = $result_row_1->team_id;
        $query_get_users = "SELECT DISTINCT user_id FROM amz_user_info WHERE team_id='{$team_id}'";
        $result_get_users = $conn->runsql($query_get_users, $dbcon);
        if (mysqli_num_rows($result_get_users)) {
            while ($result_row_get_users = mysqli_fetch_object($result_get_users)) {
                $user_id = $result_row_get_users->user_id;
                $tr_txt = $tr_color_decide_check % 2 == 0 ? "even" : "odd";
                echo "<tr class='project_{$tr_txt}'><td>" . $user_array[$user_id] . "</td>";
                $tr_color_decide_check++;
                $avg_act = $avg_fcst = $count = 0;
                $size = sizeof($month_array);
                for ($i = 1; $i < $size; $i++) {
开发者ID:asdhanapal,项目名称:dashboard_test_1,代码行数:31,代码来源:yearly_view_prod_data_d2_2.php

示例14: db

<?php

require_once '../classes/db.class.php';
$conn = new db();
$dbcon = $conn->dbConnect();
if (isset($_GET['action'])) {
    //print_r($_POST);
    $id = $_POST['id'];
    $status_tmp = $_POST['status'];
    $status = $status_tmp == 'A' ? " user_activation='1', user_status='1' " : " user_deletion='1' ";
    $sql1 = "UPDATE amz_login SET {$status} WHERE user_id='{$id}'";
    $result1 = $conn->runsql($sql1, $dbcon);
    if ($result1) {
        echo "<font color='green'>User updation complete!</font>";
        $query_getemail = "SELECT user_mail FROM amz_login where user_id='{$id}'";
        $result_1 = $conn->runsql($query_getemail, $dbcon);
        $user_mail = mysqli_fetch_object($result_1);
        $address = $user_mail->user_mail;
        $body = "Your account is activated! Please login and change your password!";
        date_default_timezone_set('America/Toronto');
        require_once '../includes/class.phpmailer.php';
        $mail = new PHPMailer();
        $mail->IsSMTP();
        // $mail->Host       = "smtp.amazon.com";
        $mail->SMTPDebug = false;
        $mail->SMTPAuth = true;
        // $mail->SMTPSecure = "ssl";
        $mail->Host = "smtp.amazon.com";
        $mail->Port = 25;
        $mail->Username = "no-reply@amazon.com";
        // $mail->Password   = "******";
开发者ID:asdhanapal,项目名称:dashboard_test_1,代码行数:31,代码来源:user_manage_inner.php

示例15: array

                <a href="#" class="close">&times;</a>
            </div>-->
        </td>
    </tr>
    <tr>
        <td width="50%">Field</td>
        <td>Value</td>
    </tr>
    
    <tr>
        <td>Parent team:</td>
        <td>
            <?php 
    $parent_teams = array();
    $query_parent_team = "SELECT team_id FROM amz_pteam_info WHERE user_id='{$user_id}'";
    $result_parent_team = $conn->runsql($query_parent_team, $dbcon);
    while ($result_row_parent_team = mysqli_fetch_object($result_parent_team)) {
        $parent_teams[] = $result_row_parent_team->team_id;
    }
    ?>
            <select id="p_team" multiple="multiple" placeholder=" -- Parent team --" class="teams">
            <?php 
    $teams = json_decode(USER_TEAMS);
    foreach ($teams as $key => $value) {
        ?>
                <option value="<?php 
        echo $value;
        ?>
" <?php 
        if (in_array($value, $parent_teams)) {
            echo "Selected";
开发者ID:asdhanapal,项目名称:dashboard_test_1,代码行数:31,代码来源:edit_user_details.php


注:本文中的db::runsql方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。