function getSingleData($strSQL){ //print ($strSQL); $restMe = mysql_query($strSQL); $rest = mysql_fetch_row($restMe); if (!($restMe)) { mysql_freeresult($restMe); } return ($rest[0]); }
function ExecuteQuery($m_sql, $mode = 0) { $value_pairs = array(); $m_result = mysql_query($m_sql, $this->m_connectionHandle); $this->m_data_rows = array(); $this->m_row_count = 0; $this->m_col_count = 0; if ($m_result) { if ($mode) { $this->m_row_count = mysql_num_rows($m_result); $this->m_col_count = mysql_num_fields($m_result); while ($rowArray = mysql_fetch_row($m_result)) { $rows_data = ""; for ($i = 0; $i < $this->m_col_count; $i++) { $fld_name = mysql_field_name($m_result, $i); $values_pairs[$fld_name] = $rowArray[$i]; //$this->DisplayLog($fld_name."= ".$rowArray[$i]."<BR>"); } $this->m_data_rows[] = $values_pairs; } } else { return mysql_insert_id($this->m_connectionHandle); } mysql_freeresult($m_result); } }
$queryStr .= " LIMIT " . $start . ",50"; } $query = mysql_query($queryStr); if (mysql_num_rows($query) > 0) { while ($result = mysql_fetch_assoc($query)) { $result['percent'] = $result['kills'] / $totalkills * 100; $maps['data'][] = $result; } } mysql_freeresult($query); // query to get the total rows which would be fetched without the LIMIT // works only if the $queryStr has SQL_CALC_FOUND_ROWS $query = mysql_query("SELECT FOUND_ROWS() AS 'rows'"); $result = mysql_fetch_assoc($query); $maps['pages'] = (int) ceil($result['rows'] / 50); mysql_freeresult($query); } pageHeader(array($gamename, l("Map Statistics")), array($gamename => "index.php?game={$game}", l("Map Statistics") => "")); ?> <div id="sidebar"> <h1><?php echo l('Options'); ?> </h1> <div class="left-box"> <ul class="sidemenu"> <li> <a href="<?php echo "index.php?game={$game}"; ?> "><?php
function clean_results() { if ($this->Query_ID != 0) { mysql_freeresult($this->Query_ID); } }
function clean_results() { # if($this->Query_ID != 0) mysql_freeresult($this->Query_ID); if ($this->Query_ID && gettype($this->Query_ID) == "resource") { if (function_exists('mysql_free_result')) { mysql_free_result($this->Query_ID); } else { mysql_freeresult($this->Query_ID); } } }
if ($path_params[1] != null) { $query = "select * from mahasiswa where nim= {$path_params['1']}"; } else { $query = "select * from mahasiswa"; } $result = mysql_query($query) or die('Query Failed : ' . mysql_error()); echo "<data>"; while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { echo "<mahasiswa>"; foreach ($line as $key => $col_value) { echo "<{$key}>{$col_value}</{$key}>"; } echo "</mahasiswa>"; } echo "</data>"; mysql_freeresult($result); } else { if ($_SERVER['REQUEST_METHOD'] == 'POST') { //$input = file_get_contents("php://input"); //echo $_POST['nim']; $querycek = "select * from mahasiswa where nim=" . $_POST['nim']; $result = mysql_query($querycek); $num_rows = mysql_num_rows($result); if ($num_rows == 0) { $query = "insert into mahasiswa (nim,nama,alamat,prodi) VALUES(\n " . $_POST['nim'] . ",\n '" . $_POST['nama'] . "',\n '" . $_POST['alamat'] . "',\n '" . $_POST['prodi'] . "')"; } else { if ($num_rows == 1) { $query = "update mahasiswa set\n nama='" . $_POST['nama'] . "',\n alamat='" . $_POST['alamat'] . "',\n prodi='" . $_POST['prodi'] . "'\n where nim =" . $_POST['nim']; } } $result = mysql_query($query) or die('Query failed : ' . mysql_error());
function IsTable($tbname) { $this->result[0] = mysql_list_tables($this->dbName,$this->linkID); while ($row = mysql_fetch_array($this->result[0])) { if(strtolower($row[0])==strtolower($tbname)) { mysql_freeresult($this->result[0]); return true; } } mysql_freeresult($this->result[0]); return false; }
function freeResult($result = false) { if (!$result && $this->lastResult) { $result = current($this->lastResult); while ($result) { mysql_freeresult($result); $result = next($this->lastResult); } $this->lastResult = array(); } if ($result) { mysql_freeresult($result); } }
/** * sets the statement cursor to key * * @param int $k * @return boolean */ public function setCursor($k) { if (isset($this->result) && $this->result) { @mysql_freeresult($this->result); unset($this->result); } $this->_bound = array(); if (!array_key_exists($k, $this->_statement)) { return false; } $this->_i = $k; return true; }
$dbpyear = date("Y",strtotime($dbdate)); if (($pmonth == $dbpmonth) and ($pyear == $dbpyear)){ echo "<td width=70px align=center><font color=blue>$result[expire_date]</font></td>"; }else if (($pmonth > $dbpmonth) AND ($pyear > $dbpyear) AND ($pdate > $dbpdate)){ //$qy = mysql_query("UPDATE ms_barang SET status='Non-Aktif' WHERE id='$result[id]'"); echo "<td width=70px align=center><font color=red>$result2[expire_date]</font></td>"; }else if (($ppmonth == $dbpmonth) AND ($pyear == $dbpyear)){ echo "<td width=70px align=center><font color=blue>$result2[expire_date]</font></td>"; }else{ echo "<td width=70px align=center>$result2[expire_date]</td>"; } echo "<td align=center width=140px>"; $sm = ""; $qreq = mysql_query("SELECT aktivasi FROM req_pembelian WHERE kd_barang='$result2[kd_barang]' and aktivasi =1 order by aktivasi ASC"); //$rreq = mysql_fetch_row($qreq); $sm = mysql_fetch_array($qreq); // print_r ($sm); mysql_freeresult($qreq); if ((!empty($sm))&& ($sm['aktivasi']= '1')){ echo "<input type=checkbox name='pq".$no."' CHECKED>" ; echo "<input type=hidden name='ap".$no."' value='".$result2['id']."'>"; // echo ("SELECT kd_barang, aktivasi FROM req_pembelian WHERE kd_barang='$result2[kd_barang]' order by aktivasi ASC"); // print_r($sm); // $sm=0; }else{ echo "<input type=checkbox name='pq".$no."'>" ; echo "<input type=hidden name='ap".$no."' value='".$result2['id']."'>"; // echo ("SELECT kd_barang, aktivasi FROM req_pembelian WHERE kd_barang='$result2[kd_barang]' order by aktivasi ASC"); // print_r($qreq); } /* if ($rreq) {
public function getParent($v7057e8409c7c531a1a6e9ac3df4ed549) { $v7057e8409c7c531a1a6e9ac3df4ed549 = (int) $v7057e8409c7c531a1a6e9ac3df4ed549; $vac5c74b64b4b8352ef2f181affb5ac2a = "SELECT rel FROM cms3_hierarchy WHERE id = '{$v7057e8409c7c531a1a6e9ac3df4ed549}'"; $result = l_mysql_query($vac5c74b64b4b8352ef2f181affb5ac2a, true); if (mysql_num_rows($result)) { list($v6be379826b20cc58475f636e33f4606b) = mysql_fetch_row($result); $this->misc_elements[] = $v6be379826b20cc58475f636e33f4606b; mysql_freeresult($result); return (int) $v6be379826b20cc58475f636e33f4606b; } else { mysql_freeresult($result); return false; } }