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


PHP query_associative_one函数代码示例

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


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

示例1: get_test_record

function get_test_record($specimen_id, $test_type_id)
{
    $query_string = "SELECT * FROM test " . "WHERE specimen_id={$specimen_id} AND test_type_id={$test_type_id} ";
    $record = query_associative_one($query_string);
    $test_entry = Test::getObject($record);
    return $test_entry;
}
开发者ID:jfurlong,项目名称:BLIS,代码行数:7,代码来源:reports_test.php

示例2: query_num_rows

function query_num_rows($table_name)
{
    global $con;
    $query_string = "SELECT COUNT(*) AS val FROM {$table_name}";
    $record = query_associative_one($query_string);
    //if($LOG_QUERIES == true)
    DebugLib::logQuery($query_string, db_get_current(), $_SESSION['username']);
    DebugLib::logDBUpdates($query, db_get_current());
    return $record['val'];
}
开发者ID:nchopra,项目名称:C4G-BLIS,代码行数:10,代码来源:db_mysql_lib.php

示例3: generate_worksheet_config

function generate_worksheet_config($lab_config_id)
{
    $lab_config = LabConfig::getById($lab_config_id);
    $test_ids = $lab_config->getTestTypeIds();
    $saved_db = DbUtil::switchToLabConfig($lab_config_id);
    foreach ($test_ids as $test_id) {
        $test_entry = TestType::getById($test_id);
        $query_string = "SELECT * FROM report_config WHERE test_type_id={$test_id} LIMIT 1";
        $record = query_associative_one($query_string);
        if ($record == null) {
            # Add new entry
            $query_string_add = "INSERT INTO report_config (" . "test_type_id, header, footer, margins, " . "p_fields, s_fields, t_fields, p_custom_fields, s_custom_fields " . ") VALUES (" . "'{$test_id}', 'Worksheet - " . $test_entry->name . "', '', '5,0,5,0', " . "'0,1,0,1,1,0,0', '0,0,1,1,0,0', '1,0,1,0,0,0,0,1', '', '' " . ")";
            query_insert_one($query_string_add);
        }
    }
    DbUtil::switchRestore($saved_db);
}
开发者ID:jfurlong,项目名称:BLIS,代码行数:17,代码来源:worksheet_config_generate.php

示例4: get_records_to_print

function get_records_to_print($lab_config, $patient_id, $specimen_id)
{
    $retval = array();
    $query_string = "SELECT * FROM test,specimen " . "WHERE specimen.specimen_id={$specimen_id} and test.specimen_id=specimen.specimen_id and specimen.patient_id={$patient_id}";
    $resultset = query_associative_one($query_string);
    if ($resultset == null) {
        echo "hiral";
    }
    $test = Test::getObject($resultset);
    $hide_patient_name = TestType::toHidePatientName($test->testTypeId);
    if ($hide_patient_name == 1) {
        $hidePatientName = 1;
    }
    $specimen = get_specimen_by_id($test->specimenId);
    $retval[] = array($test, $specimen, $hide_patient_name);
    return $retval;
}
开发者ID:jfurlong,项目名称:BLIS,代码行数:17,代码来源:report_onetesthistory.php

示例5: verify_and_update

function verify_and_update($test_type_id, $verified_entry, $hash_value)
{
    $specimen_id = $verified_entry->specimenId;
    $query_string = "SELECT * FROM test " . "WHERE specimen_id={$specimen_id} " . "AND test_type_id={$test_type_id} LIMIT 1";
    $record = query_associative_one($query_string);
    $existing_entry = Test::getObject($record);
    $test_id = $existing_entry->testId;
    $verified_result_value = $verified_entry->result . $hash_value;
    $query_verify = "";
    if ($existing_entry->result == $verified_result_value && $existing_entry->comments == $verified_entry->comments) {
        # No changes or corrections after verification
        $query_verify = "UPDATE test " . "SET verified_by={$verified_entry->verifiedBy}, " . "date_verified='{$verified_entry->dateVerified}' " . "WHERE test_id={$test_id}";
    } else {
        # Update with corrections and mark as verified
        $query_verify = "UPDATE test " . "SET result='{$verified_result_value}', " . "comments='{$verified_entry->comments}', " . "verified_by={$verified_entry->verifiedBy}, " . "date_verified='{$verified_entry->dateVerified}' " . "WHERE test_id={$test_id}";
    }
    query_blind($query_verify);
}
开发者ID:caseyi,项目名称:BLIS,代码行数:18,代码来源:results_verify_do.php

示例6: COUNT

<?php

include "../includes/db_lib.php";
$attrib_value = $_REQUEST['q'];
$count = 0;
$query_string = "SELECT COUNT(specimen_id) AS val FROM test WHERE result='' " . "AND test_type_id IN (SELECT test_type_id FROM test_type WHERE test_category_id={$attrib_value}) AND specimen_id NOT IN (select r_id from removal_record where status='1' AND category='specimen')";
$resultset = query_associative_one($query_string);
$count = $resultset['val'];
echo $count;
开发者ID:caseyi,项目名称:BLIS,代码行数:9,代码来源:result_data_count_labsection.php

示例7: getDailyNum

 public function getDailyNum()
 {
     # Returns daily number ("patient number")
     # Fetches value from the latest specimen which was assigned to this patient
     $query_string = "SELECT s.daily_num FROM specimen s, patient p " . "WHERE s.patient_id=p.patient_id " . "AND p.patient_id={$this->patientId} " . "ORDER BY s.date_collected DESC";
     $record = query_associative_one($query_string);
     $retval = "";
     if ($record == null || trim($record['daily_num']) == "") {
         $retval = "-";
     } else {
         $retval = $record['daily_num'];
     }
     return $retval;
 }
开发者ID:nchopra,项目名称:C4G-BLIS,代码行数:14,代码来源:db_lib.php

示例8: getEditCustomWorksheetForm


//.........这里部分代码省略.........
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					<?php echo LangUtil::$pageTerms['COLUMN_WIDTH']; ?>
					<br>
					<?php
					if($worksheet->userFields == null || count($worksheet->userFields) == 0)
					{
						//echo LangUtil::$generalTerms['NO']."<br>";
					}
					foreach($worksheet->userFields as $field_entry)
					{
						$field_id = $field_entry[0];
						$field_name = $field_entry[1];
						$field_width = $field_entry[2];
						?>
						<input type='hidden' name='existing_uf_id[]' value='<?php echo $field_id; ?>'></input>
						<input type='text' name='existing_uf_name[]' value='<?php echo $field_name; ?>' class='uniform_width'></input>
						<input type='text' name='existing_uf_width[]' size='2' value='<?php echo $field_width; ?>'></input>
						<br>
						<?php
					}
					?>
					</span>
					<small><a href='javascript:add_another_uf();'><?php echo LangUtil::$generalTerms['ADDNEW']; ?>&raquo;</a></small>
				</td>
			</tr>
			<tr valign='top'>
				<td><?php echo LangUtil::$generalTerms['LAB_SECTION']; ?></td>
				<td>
					<?php
					$test_type_id = $worksheet->testTypes[0];
					$saved_db = DbUtil::switchToGlobal();
					$query_string = "SELECT test_category_id FROM test_type WHERE test_type_id=$test_type_id";
					$record = query_associative_one($query_string);
					$cat_code = $record['test_category_id'];
					$cat_name = get_test_category_name_by_id($cat_code);
					DbUtil::switchRestore($saved_db);				
					echo $cat_name;
					?>
				</td>
			</tr>
		</table>
		<br>
		<div id='test_boxes' class='smaller_font' style='width:auto;'>
		<?php
		$test_type_list = get_test_types_by_site_category($lab_config->id, $cat_code);
		foreach($test_type_list as $test_type)
		{
			$measure_list = $test_type->getMeasures();
			?>
			<div>
			<input type='checkbox' class='test_type_checkbox' name='ttype_<?php echo $test_type->testTypeId; ?>' id='ttype_<?php echo $test_type->testTypeId; ?>' <?php
			if(in_array($test_type->testTypeId, $worksheet->testTypes))
				echo " checked ";
			?>>
			<?php echo $test_type->getName(); ?>
			</input>
			<br>
				<div id='ttype_<?php echo $test_type->testTypeId; ?>_mlist' style='position:relative; margin-left:15px;<?php
				if(in_array($test_type->testTypeId, $worksheet->testTypes) === false)
					echo "display:none;";
				?>'>
				<table class='hor-minimalist-b'>
					<thead>
					<tr>
						<th style='width:200px;'><?php echo LangUtil::$generalTerms['MEASURES']; ?></th>
开发者ID:jfurlong,项目名称:BLIS,代码行数:67,代码来源:page_elemsdff.php

示例9: MAX

<?php

include "../includes/db_lib.php";
$userId = $_SESSION['user_id'];
$testCategoryName = $_REQUEST['testCategoryName'];
$labIdTestCategoryId = $_REQUEST['labIdTestCategoryId'];
$saved_db = DbUtil::switchToGlobal();
$queryString = "SELECT MAX(test_category_id) AS test_category_id FROM test_category_mapping " . "WHERE user_id={$userId}";
$record = query_associative_one($queryString);
$testCategoryId = intval($record['test_category_id']) + 1;
$queryString = "INSERT INTO TEST_CATEGORY_MAPPING (user_id, test_category_name, lab_id_test_category_id, test_category_id) " . "VALUES (" . $userId . ",'" . $testCategoryName . "','" . $labIdTestCategoryId . "'," . $testCategoryId . ")";
query_insert_one($queryString) or die(mysql_error());
DbUtil::switchRestore($saved_db);
echo "true";
开发者ID:jfurlong,项目名称:BLIS,代码行数:14,代码来源:add_country_level_test_categories.php

示例10: get_user_by_id

	</ul>
	</div>

<div id='new_help' style='display:none'>
<small>
<u>Add New</u> lets you add new registration fields as required for the lab.
</small>
</div>

<?php 
$lab_config_id = $_REQUEST['id'];
$user = get_user_by_id($_SESSION['user_id']);
if (!(is_country_dir($user) || is_super_admin($user))) {
    $saved_db = DbUtil::switchToGlobal();
    $query = "SELECT lab_config_id FROM lab_config WHERE admin_user_id = " . $_SESSION['user_id'];
    $record = query_associative_one($query);
    $labId = $record['lab_config_id'];
    if ($labId != $lab_config_id) {
        echo "You are not authorized to access the configuration";
        include "includes/footer.php";
        die;
    }
    DbUtil::switchRestore($saved_db);
}
//echo "Lab Config Id ".$lab_config_id;
$lab_config = LabConfig::getById($lab_config_id);
//echo "specimen Id ".$lab_config->sid;
if ($lab_config == null) {
    ?>
	<br><br>
	<div class='sidetip_nopos'>
开发者ID:jfurlong,项目名称:BLIS,代码行数:31,代码来源:lab_config_home_old1.php

示例11: processWeeklyTrends

function processWeeklyTrends($lab_config_id, $test_type_id, $date_from, $date_to, $test_name = null)
{
    global $namesArray;
    global $stat_list;
    # All Tests & All Labs */
    if ($test_type_id == 0 && $lab_config_id == 0) {
        $site_list = get_site_list($_SESSION['user_id']);
        $userId = $_SESSION['user_id'];
        $saved_db = DbUtil::switchToGlobal();
        $query = "SELECT * FROM test_mapping WHERE user_id = {$userId}";
        $resultset = query_associative_all($query, $row_count);
        foreach ($resultset as $record) {
            $labIdTestIds = explode(';', $record['lab_id_test_id']);
            foreach ($labIdTestIds as $labIdTestId) {
                $labIdTestId = explode(':', $labIdTestId);
                $labId = $labIdTestId[0];
                $testId = $labIdTestId[1];
                $test_type_list_all[$labId][] = $testId;
                $test_type_names[$labId][] = $record['test_name'];
            }
        }
        DbUtil::switchRestore($saved_db);
        foreach ($site_list as $key => $value) {
            $lab_config = LabConfig::getById($key);
            $test_type_list = array();
            $test_type_list = $test_type_list_all[$key];
            $testNames = $test_type_names[$key];
            $saved_db = DbUtil::switchToLabConfig($lab_config->id);
            $testCount = -1;
            foreach ($test_type_list as $test_type_id) {
                $query_string = "SELECT COUNT(*) AS count_val FROM test t, specimen s " . "WHERE t.test_type_id={$test_type_id} " . "AND t.specimen_id=s.specimen_id " . "AND result!=''" . "AND ( s.date_collected BETWEEN '{$date_from}' AND '{$date_to}' )";
                $record = query_associative_one($query_string);
                $count_all = intval($record['count_val']);
                $testCount++;
                if ($count_all == 0) {
                    continue;
                }
                $namesArray[] = $lab_config->name . " - " . $testNames[$testCount];
                getWeeklyStats($lab_config, $test_type_id, $date_from, $date_to);
            }
        }
    } else {
        if ($test_type_id == 0 && count($lab_config_id) == 1) {
            $lab_config = LabConfig::getById($lab_config_id[0]);
            $test_type_list = get_discrete_value_test_types($lab_config);
            foreach ($test_type_list as $test_type_id) {
                $namesArray[] = get_test_name_by_id($test_type_id, $lab_config_id[0]);
                getWeeklyStats($lab_config, $test_type_id, $date_from, $date_to);
            }
        } else {
            if ($test_type_id == 0 && count($lab_config_id) > 1) {
                $userId = $_SESSION['user_id'];
                $saved_db = DbUtil::switchToGlobal();
                $query = "SELECT * FROM test_mapping WHERE user_id = {$userId}";
                $resultset = query_associative_all($query, $row_count);
                foreach ($resultset as $record) {
                    $labIdTestIds = explode(';', $record['lab_id_test_id']);
                    foreach ($labIdTestIds as $labIdTestId) {
                        $labIdTestId = explode(':', $labIdTestId);
                        $labId = $labIdTestId[0];
                        $testId = $labIdTestId[1];
                        $test_type_list_all[$labId][] = $testId;
                        $test_type_names[$labId][] = $record['test_name'];
                    }
                }
                DbUtil::switchRestore($saved_db);
                foreach ($lab_config_id as $key) {
                    $lab_config = LabConfig::getById($key);
                    $test_type_list = array();
                    $test_type_list = $test_type_list_all[$key];
                    $testNames = $test_type_names[$key];
                    $saved_db = DbUtil::switchToLabConfig($lab_config->id);
                    $testCount = -1;
                    foreach ($test_type_list as $test_type_id) {
                        $query_string = "SELECT COUNT(*) AS count_val FROM test t, specimen s " . "WHERE t.test_type_id={$test_type_id} " . "AND t.specimen_id=s.specimen_id " . "AND result!=''" . "AND ( s.date_collected BETWEEN '{$date_from}' AND '{$date_to}' )";
                        $record = query_associative_one($query_string);
                        $count_all = intval($record['count_val']);
                        $testCount++;
                        if ($count_all == 0) {
                            continue;
                        }
                        $namesArray[] = $lab_config->name . " - " . $testNames[$testCount];
                        getWeeklyStats($lab_config, $test_type_id, $date_from, $date_to);
                    }
                }
            } else {
                /* Build Array Map with Lab Id as Key and Test Id as corresponding Value */
                $labIdTestIds = explode(";", $test_type_id);
                $testIds = array();
                foreach ($labIdTestIds as $labIdTestId) {
                    $labIdTestIdsSeparated = explode(":", $labIdTestId);
                    $labId = $labIdTestIdsSeparated[0];
                    $testId = $labIdTestIdsSeparated[1];
                    $testIds[$labId] = $testId;
                }
                # Particular Test & All Labs
                if ($test_type_id != 0 && $lab_config_id == 0) {
                    $site_list = get_site_list($_SESSION['user_id']);
                    foreach ($site_list as $key => $value) {
                        $lab_config = LabConfig::getById($key);
//.........这里部分代码省略.........
开发者ID:jfurlong,项目名称:BLIS,代码行数:101,代码来源:report_prevalence_agg.php

示例12: explode

            $labIdTestIdsSeparated = explode(":", $labIdTestId);
            $labId = $labIdTestIdsSeparated[0];
            $testId = $labIdTestIdsSeparated[1];
            $testIds[$labId] = $testId;
        }
        foreach ($testRecords as $testRecord) {
            if ($testIds[$labConfigId] == $testRecord->testTypeId) {
                $testRecord->testTypeId = $testIds[$importLabConfigId];
            }
        }
    }
}
DbUtil::switchRestore($saved_db);
$saved_db = DbUtil::switchToLabConfig($importLabConfigId);
$querySelect = "SELECT * FROM patient " . "WHERE patient_id={$importPatientId}";
$record = query_associative_one($querySelect);
$patientName = $record['name'];
$patient = Patient::getObject($record);
$patient->createdBy = $_SESSION['user_id'];
DbUtil::switchRestore($saved_db);
add_patient($patient, true);
/*
$querySelect =
	"SELECT patient_id FROM patient ".
	"WHERE name like '$patientName' ";
$record = query_associative_one($querySelect);
$newPatientId = $record['patient_id'];
*/
/* Create New Specimen & Test Records */
$i = 0;
foreach ($specimenRecords as $specimenRecord) {
开发者ID:jfurlong,项目名称:BLIS,代码行数:31,代码来源:import_patient.php

示例13: get_test_cost

 public function get_test_cost($tid)
 {
     if ($_SESSION['level'] < 2 || $_SESSION['level'] > 4) {
         $user = get_user_by_id($_SESSION['user_id']);
         $lid = $user->labConfigId;
     }
     if ($lid == null) {
         $lid = get_lab_config_id_admin($_SESSION['user_id']);
     }
     //$stocks_list = Inventory::getStocksList($lid, $r_id);
     $lab_config_id = $lid;
     $saved_db = DbUtil::switchToLabConfig($lab_config_id);
     $query_string = "SELECT * from test_type_costs WHERE test_type_id = {$tid} ORDER BY earliest_date_valid DESC LIMIT 1";
     $record = query_associative_one($query_string);
     DbUtil::switchRestore($saved_db);
     if ($record != null) {
         $ret = $record['amount'];
     } else {
         $ret = -1;
     }
     return $ret;
 }
开发者ID:caseyi,项目名称:BLIS,代码行数:22,代码来源:db_lib.php

示例14: getReagentUnit

 public function getReagentUnit($lid, $id)
 {
     $lab_config_id = $lid;
     $saved_db = DbUtil::switchToLabConfig($lab_config_id);
     $query_string = "SELECT unit from inv_reagent WHERE id={$id}";
     $recordset = query_associative_one($query_string);
     DbUtil::switchRestore($saved_db);
     return $recordset['unit'];
 }
开发者ID:caseyi,项目名称:BLIS,代码行数:9,代码来源:db_libdff.php

示例15: getDiscreteInfectionStatsDaily

     } else {
         if ($type == 'd') {
             $query_string = "SELECT s.date_collected  AS week ,COUNT(*) AS count_val  FROM test t, patient p,specimen s " . "WHERE t.test_type_id={$test_type_id} " . "AND t.specimen_id=s.specimen_id " . "AND p.patient_id=s.patient_id " . "AND p.sex= '{$gender}' " . "AND t.result!=''" . "AND (s.date_collected BETWEEN '{$date_from}' AND '{$date_to}') " . "GROUP BY s.date_collected";
             $resultset = query_associative_all($query_string, $row_count);
             $query_string1 = "SELECT s.date_collected AS week ,COUNT(*) AS count_val  FROM test t, patient p,specimen s " . "WHERE t.test_type_id={$test_type_id} " . "AND t.specimen_id=s.specimen_id " . "AND p.patient_id=s.patient_id " . "AND p.sex= '{$gender}' " . "AND (t.result LIKE 'N,%' OR t.result LIKE 'n�gatif,%' OR t.result LIKE 'negatif,%' OR t.result LIKE 'n,%' OR t.result LIKE 'negative,%')" . "AND (s.date_collected BETWEEN '{$date_from}' AND '{$date_to}') " . "GROUP BY s.date_collected";
             $resultset1 = query_associative_all($query_string1, $row_count1);
         } else {
             $query_string = "SELECT year(s.date_collected), s.date_collected  AS week ,COUNT(*) AS count_val  FROM test t, patient p,specimen s " . "WHERE t.test_type_id={$test_type_id} " . "AND t.specimen_id=s.specimen_id " . "AND t.result!=''" . "AND p.patient_id=s.patient_id " . "AND p.sex= '{$gender}' " . "AND (s.date_collected BETWEEN '{$date_from}' AND '{$date_to}') " . "GROUP BY year(s.date_collected), month(s.date_collected)";
             $resultset = query_associative_all($query_string, $row_count);
             $query_string1 = "SELECT year(s.date_collected), s.date_collected AS week ,COUNT(*) AS count_val  FROM test t, patient p,specimen s " . "WHERE t.test_type_id={$test_type_id} " . "AND t.specimen_id=s.specimen_id " . "AND p.patient_id=s.patient_id " . "AND p.sex= '{$gender}' " . "AND (t.result LIKE 'N,%' OR t.result LIKE 'n�gatif,%' OR t.result LIKE 'negatif,%' OR t.result LIKE 'n,%' OR t.result LIKE 'negative,%')" . "AND (s.date_collected BETWEEN '{$date_from}' AND '{$date_to}') " . "GROUP BY year(s.date_collected),month(s.date_collected)";
             $resultset1 = query_associative_all($query_string1, $row_count1);
         }
     }
     $record_total = array();
     $record_neg = array();
     foreach ($resultset1 as $record) {
         $week = $record['week'];
         $record_neg[$week] = $record['count_val'];
     }
     foreach ($resultset as $record) {
         $week = $record['week'];
         $count++;
         $record_total[$week] = $record['count_val'];
     }
     $counter = 0;
     foreach ($record_total as $key => $value) {
         if ($record_neg[$key] == "") {
             $count_negative = 0;
         } else {
             $count_negative = $record_neg[$key];
         }
         $count_all = $value;
         $date_from_parts = explode("-", $key);
         $date_ts = mktime(0, 0, 0, $date_from_parts[1] + $i, $date_from_parts[2], $date_from_parts[0]);
         $retval[$counter] = array($count_all, $count_negative, $date_ts);
         $counter++;
     }
     DbUtil::switchRestore($saved_db);
     return $retval;
 }
 public static function getDiscreteInfectionStatsDaily($lab_config, $test_type_id, $date_from, $date_to, $gender = null)
 {
     $i = 1;
     # Fetch all test types with one measure having discrete P/N range
     $retval = array();
     $saved_db = DbUtil::switchToLabConfig($lab_config->id);
     $date_from_parts = explode("-", $date_from);
     $date_to_parts = explode("-", $date_to);
     $date_ts = mktime(0, 0, 0, $date_from_parts[1], $date_from_parts[2], $date_from_parts[0]);
     $date_to_ts = mktime(0, 0, 0, $date_to_parts[1], $date_to_parts[2], $date_to_parts[0]);
     while ($date_ts < $date_to_ts) {
         $second_day_ts = mktime(0, 0, 0, $date_from_parts[1], $date_from_parts[2] + $i, $date_from_parts[0]);
         $date_fromp = date("Y-m-d", $date_ts);
开发者ID:caseyi,项目名称:BLIS,代码行数:53,代码来源:stats_lib.php


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