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


PHP SqlQuery函数代码示例

本文整理汇总了PHP中SqlQuery函数的典型用法代码示例。如果您正苦于以下问题:PHP SqlQuery函数的具体用法?PHP SqlQuery怎么用?PHP SqlQuery使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: GenerateDownload

function GenerateDownload()
{
    $loc = rmabs(__FILE__ . ".GenerateDownload");
    $sql = 'SELECT * FROM Users';
    $result = SqlQuery($loc, $sql);
    $first = true;
    header('Content-Type: application/csv');
    header('Content-Disposition: attachment; filename="Users_' . date("Y-m-d") . '.csv";');
    $ff = fopen('php://memory', 'w');
    //rewind($f);
    $fieldnames = array();
    while ($row = $result->fetch_assoc()) {
        if ($first) {
            $fieldnames = array_keys($row);
            fputcsv($ff, $fieldnames, ",");
            $first = false;
        }
        $data = array();
        foreach ($fieldnames as $k) {
            if (isset($row[$k])) {
                $data[] = $row[$k];
            } else {
                $data[] = "";
            }
        }
        fputcsv($ff, $data);
    }
    fseek($ff, 0);
    header('Content-Type: application/csv');
    header('Content-Disposition: attachment; filename="Users_' . date("Y-m-d") . '.csv";');
    fpassthru($ff);
}
开发者ID:VCHSRobots,项目名称:EpicScouts,代码行数:32,代码来源:admin_uploadusers.php

示例2: up

 function up()
 {
     $sql = "CREATE TABLE priority\n\t\t\t\t(\n\t\t\t\t\tid int2 primary key,\n\t\t\t\t\tname text\n\t\t\t\t)";
     SqlAlterSchema($sql);
     SqlQuery("insert into priority (id, name) values (1, 'Low')", array());
     SqlQuery("insert into priority (id, name) values (2, 'Medium')", array());
     SqlQuery("insert into priority (id, name) values (3, 'High')", array());
     $sql = "ALTER TABLE request add column priority_id int2 references priority not null default 1";
     SqlAlterSchema($sql);
 }
开发者ID:laiello,项目名称:zoop,代码行数:10,代码来源:3_priority.php

示例3: get_all_accounts

function get_all_accounts()
{
    $loc = rmabs(__FILE__ . ".get_all_accounts");
    $sql = "SELECT UserID from Users";
    $result = SqlQuery($loc, $sql);
    while ($row = $result->fetch_assoc()) {
        $aws[] = intval($row["UserID"]);
    }
    return $aws;
}
开发者ID:VCHSRobots,项目名称:EpicTeam,代码行数:10,代码来源:utils_testdata.php

示例4: GetWorkOrderPrereqInfo

function GetWorkOrderPrereqInfo($userid)
{
    $loc = "userlib.php->GetUserInfo";
    $sql = 'SELECT * FROM UserView WHERE UserID=' . SqlClean($userid);
    $result = SqlQuery($loc, $sql);
    if ($result->num_rows != 1) {
        return false;
    }
    $row = $result->fetch_assoc();
    return $row;
}
开发者ID:sshibs,项目名称:EpicRobotzWebsite,代码行数:11,代码来源:workorderlib.php

示例5: changeactive

function changeactive($wid, $active)
{
    global $username;
    $loc = rmabs(__FILE__ . ".changeactive");
    $sql = 'UPDATE WorkOrders SET Active=' . intval($active) . ' WHERE WID=' . intval($wid);
    $result = SqlQuery($loc, $sql);
    $action = "archvied";
    if ($active) {
        $action = "resurrected";
    }
    return 'Work Order ' . intval($wid) . ' has been ' . $action . ' by ' . $username . '.';
}
开发者ID:VCHSRobots,项目名称:EpicTeam,代码行数:12,代码来源:utils_archive.php

示例6: GetPicCaption

function GetPicCaption($wid, $picid)
{
    $loc = rmabs(__FILE__ . ".GetPicCaption");
    if (empty($wid) || empty($picid)) {
        return "";
    }
    $sql = 'SELECT * From AppendedData Where WID=' . intval($wid) . ' AND PicID=' . intval($picid);
    $result = SqlQuery($loc, $sql);
    if ($result->num_rows <= 0) {
        return "";
    }
    $row = $result->fetch_assoc();
    return $row["TextInfo"];
}
开发者ID:VCHSRobots,项目名称:EpicTeam,代码行数:14,代码来源:display_image.php

示例7: delete_workorder

function delete_workorder($woinfo)
{
    global $username;
    $loc = rmabs(__FILE__ . ".delete_workorder");
    $wid = $woinfo["WID"];
    $sql = "DELETE FROM Assignments WHERE WID=" . intval($wid);
    SqlQuery($loc, $sql);
    $sql = "DELETE FROM AppendedData WHERE WID=" . intval($wid);
    SqlQuery($loc, $sql);
    $sql = "DELETE FROM WorkOrders WHERE WID=" . intval($wid);
    SqlQuery($loc, $sql);
    $widstr = WIDStr($wid, $woinfo["Revision"], $woinfo["IsApproved"]);
    $msg = "Work Order " . $widstr . " deleted by " . $username . ".";
    log_msg($loc, $msg);
    return $msg;
}
开发者ID:VCHSRobots,项目名称:EpicTeam,代码行数:16,代码来源:utils_delete.php

示例8: GetAllWorkers

function GetAllWorkers()
{
    $loc = rmabs(__FILE__ . "GetAllWorkers");
    $sql = 'SELECT * FROM AllActiveUsersView ORDER BY LastName, FirstName';
    $result = SqlQuery($loc, $sql);
    $d = array();
    while ($row = $result->fetch_assoc()) {
        $tags = ArrayFromSlashStr($row["Tags"]);
        if (CheckArrayForEasyMatch($tags, "worker")) {
            $row["AbbrivatedName"] = MakeAbbrivatedName($row);
            $d[] = $row;
        }
    }
    return $d;
}
开发者ID:VCHSRobots,项目名称:EpicTeam,代码行数:15,代码来源:workorderlib.php

示例9: DeleteAllPrefsForUser

function DeleteAllPrefsForUser($userid)
{
    $loc = "preflib.php->DeleteAllPrefsForUser";
    $sql = 'DELETE FROM Prefs WHERE UserID=' . intval($userid);
    $result = SqlQuery($loc, $sql);
    log_msg($loc, 'All preferences deleted successfully for user ' . intval($userid));
}
开发者ID:sshibs,项目名称:EpicRobotzWebsite,代码行数:7,代码来源:preflib.php

示例10: graphsGetRanges

function graphsGetRanges($name) {
  global $is_lbf, $pid, $table;
  if ($is_lbf) {
    // Like below, but for LBF data.
    $ranges = sqlQuery("SELECT " .
      "MAX(CONVERT(ld.field_value, SIGNED)) AS max_" . add_escape_custom($name) . ", " .
      "MAX(UNIX_TIMESTAMP(f.date)) AS max_date, " .
      "MIN(UNIX_TIMESTAMP(f.date)) AS min_date " .
      "FROM forms AS f, lbf_data AS ld WHERE " .
      "f.pid = ? AND " .
      "f.formdir = ? AND " .
      "f.deleted = 0 AND " .
      "ld.form_id = f.form_id AND " .
      "ld.field_id = ? AND " .
      "ld.field_value != '0'",
      array($pid, $table, $name));
  }
  else {
    $ranges = SqlQuery("SELECT " .
      "MAX(CONVERT(" . add_escape_custom($name) . ",SIGNED)) AS " .
      "max_" . add_escape_custom($name) . ", " .
      "MAX(UNIX_TIMESTAMP(date)) as max_date, " .
      "MIN(UNIX_TIMESTAMP(date)) as min_date  " .
      "FROM " . add_escape_custom($table) . " " .
		  "WHERE " . add_escape_custom($name) . " != 0 " .
		  "AND pid = ?", array($pid));
  }
  return $ranges;
}
开发者ID:juggernautsei,项目名称:openemr,代码行数:29,代码来源:graphs.php

示例11: GetPicIDForUserID

function GetPicIDForUserID($userid)
{
    $loc = 'piclib.php->GetPicIDForUserID';
    $sql = 'SELECT PicID From UserPics WHERE UserID=' . intval($userid);
    $result = SqlQuery($loc, $sql);
    while ($row = $result->fetch_assoc()) {
        $picid = $row["PicID"];
        return $picid;
    }
    return 0;
}
开发者ID:sshibs,项目名称:EpicRobotzWebsite,代码行数:11,代码来源:piclib.php

示例12: MakeGifImages

function MakeGifImages()
{
    $loc = 'badges_showall.php->MakeAllBadges';
    $sql = 'SELECT * FROM UserView ORDER BY BadgeID';
    $result = SqlQuery($loc, $sql);
    $nempty = 0;
    $nmade = 0;
    $nfail = 0;
    while ($row = $result->fetch_assoc()) {
        if ($row["Active"] == false) {
            continue;
        }
        $tags = ArrayFromSlashStr($row["Tags"]);
        if (!in_array("member", $tags)) {
            continue;
        }
        $badgeid = $row["BadgeID"];
        if (empty($badgeid)) {
            $nempty++;
            continue;
        }
        $r = MakeGif($row);
        if ($r === true) {
            $nmade++;
        } else {
            $nfail++;
        }
    }
    $status = 'Images Made: ' . $nmade . ', Members without BadgeIDs: ' . $nempty;
    if ($nfail > 0) {
        $status .= ', Failures: ' . $nfail . '. (See sys log!)';
    }
    log_msg($loc, array('All gif images made!', $status));
    return $status;
}
开发者ID:sshibs,项目名称:EpicRobotzWebsite,代码行数:35,代码来源:badges_showall.php

示例13: ShowRawScans

function ShowRawScans($badgeid)
{
    $loc = "attendance_user.php->ShowRawScans()";
    $sql = 'SELECT * from RawScans WHERE BadgeID="' . $badgeid . '"';
    $result = SqlQuery($loc, $sql);
    while ($row = $result->fetch_assoc()) {
        echo '<div style="display: block; height: 20px; ">';
        echo '<br>' . "\n";
        echo '<div style="float: left; width: 180px;">';
        echo $row["ScanTime"];
        echo '</div>' . "\n";
        $dir = "";
        if ($row["Direction"] == 0) {
            $dir = "Scan In";
        }
        if ($row["Direction"] == 1) {
            $dir = "Scan Out";
        }
        if ($row["Direction"] == 2) {
            $dir = "?";
        }
        echo '<div style="float: left; width: 100px;">';
        echo $dir;
        echo '</div>' . "\n";
        echo '<div style="float: left; width: 80px;">';
        echo $row["Flags"];
        echo '</div>' . "\n";
        echo '<div style="clear: both;"></div>' . "\n";
        echo '</div>';
    }
}
开发者ID:sshibs,项目名称:EpicRobotzWebsite,代码行数:31,代码来源:attendance_user.php

示例14: down

 function down()
 {
     SqlQuery("drop table entry");
     SqlQuery("drop table project");
     SqlQuery("drop table person");
 }
开发者ID:laiello,项目名称:zoop,代码行数:6,代码来源:00.00.01_start.php

示例15: SqlStatement

    exit;
}
// If blood pressure, then collect the other reading to allow graphing both in same graph
$isBP = 0;
if ($name == "bps" || $name == "bpd") {
    // Set BP flag and collect other pressure reading
    $isBP = 1;
    if ($name == "bps") {
        $name_alt = "bpd";
    }
    if ($name == "bpd") {
        $name_alt = "bps";
    }
    // Collect the pertinent vitals and ranges.
    $values_alt = SqlStatement("SELECT " . add_escape_custom($name_alt) . ", " . "UNIX_TIMESTAMP(date) as unix_date " . "FROM " . add_escape_custom($table) . " " . "WHERE pid=? ORDER BY date", array($pid));
    $ranges_alt = SqlQuery("SELECT MAX(CONVERT(" . add_escape_custom($name_alt) . ",SIGNED)) AS " . "max_" . add_escape_custom($name_alt) . ", " . "MAX(UNIX_TIMESTAMP(date)) as max_date, " . "MIN(UNIX_TIMESTAMP(date)) as min_date  " . "FROM " . add_escape_custom($table) . " " . "WHERE pid=?", array($pid));
}
// Prepare look and feel of data points
$s = new scatter_line('#DB1750', 2);
$def = new hollow_dot();
$def->size(4)->halo_size(3)->tooltip('#val#<br>#date:Y-m-d H:i#');
$s->set_default_dot_style($def);
if ($isBP) {
    //set up the other blood pressure line
    $s_alt = new scatter_line('#0000FF', 2);
    $s_alt->set_default_dot_style($def);
}
// Prepare and insert data
$data = array();
while ($row = sqlFetchArray($values)) {
    if ($row["{$name}"]) {
开发者ID:hompothgyorgy,项目名称:openemr,代码行数:31,代码来源:graphs.php


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