本文整理汇总了PHP中result函数的典型用法代码示例。如果您正苦于以下问题:PHP result函数的具体用法?PHP result怎么用?PHP result使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了result函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_news
/**
* returns $number news items from class $type
*/
function get_news($type, $number)
{
$news = "SELECT `ID`, `timestamp`, `subject`, `body` FROM `news` WHERE `class`='{$type}' ORDER BY `ID` DESC LIMIT {$number}";
connect_sql();
$news = @query($news) or die("Error getting the news.");
// see if we don't have any news
if (num_rows($news) == 0) {
return "No news.";
} else {
$to_return = "";
while ($row = result($news)) {
$id = $row->ID;
$timestamp = $row->timestamp;
$subject = stripslashes($row->subject);
$body = $row->body;
// convert line breaks to <br />'s
$body = str_replace("\\r\\n", "<br />", $body);
// for windows and IP protocols
$body = str_replace("\\n", "<br />", $body);
// for nix
$body = str_replace("\\r", "<br />", $body);
// for mac
$body = stripslashes($body);
$to_return .= $id . "::::" . $timestamp . "::::" . $subject . "::::" . $body . "_____";
}
return $to_return;
}
disconnect_sql();
}
示例2: turn
function turn($arg, $mode1, $mode2)
{
switch (result($arg, $mode1)) {
case 0 . "":
return "零" . turn2($mode2);
case 1 . "":
return "壹" . turn2($mode2);
case 2 . "":
return "贰" . turn2($mode2);
case 3 . "":
return "叁" . turn2($mode2);
case 4 . "":
return "肆" . turn2($mode2);
case 5 . "":
return "伍" . turn2($mode2);
case 6 . "":
return "陆" . turn2($mode2);
case 7 . "":
return "柒" . turn2($mode2);
case 8 . "":
return "捌" . turn2($mode2);
case 9 . "":
return "玖" . turn2($mode2);
default:
return " ";
}
}
示例3: isFree
function isFree()
{
$rs = qdb("SELECT IS_FREE_LOCK('" . $this->lockname . "')");
$lock = (bool) result($rs, 0);
mysqli_free_result($rs);
return $lock;
}
示例4: get
/**
* Gets a dot-notated key from an array, with a default value if it does
* not exist.
*
* @param array $array The search array
* @param mixed $key The dot-notated key or array of keys
* @param string $default The default value
* @return mixed
*/
public static function get($array, $key, $default = null)
{
if (!is_array($array) and !$array instanceof \ArrayAccess) {
throw new \InvalidArgumentException('First parameter must be an array or ArrayAccess object.');
}
if (is_null($key)) {
return $array;
}
if (is_array($key)) {
$return = array();
foreach ($key as $k) {
$return[$k] = static::get($array, $k, $default);
}
return $return;
}
foreach (explode('.', $key) as $key_part) {
if (($array instanceof \ArrayAccess and isset($array[$key_part])) === false) {
if (!is_array($array) or !array_key_exists($key_part, $array)) {
return result($default);
}
}
$array = $array[$key_part];
}
return $array;
}
示例5: __callStatic
/**
* Provides a helper in various ways.
*
* @return mixed Could be object, boolean, or callback result.
*/
public static function __callStatic($fn, $args = array())
{
if (isset(static::$helpers[$fn]) || static::load($fn)) {
return result(static::$helpers[$fn], $args);
}
trigger_error("Cannot load helper {$fn}", E_USER_NOTICE);
}
示例6: getSegment
/**
* Get the specified URI segment, return default if it doesn't exist.
*
* Segment index is 1 based, not 0 based
*
* @param string $segment The 1-based segment index
* @param mixed $default The default value
* @return mixed
*/
public function getSegment($segment, $default = null)
{
if (isset($this->segments[$segment - 1])) {
return $this->segments[$segment - 1];
}
return result($default);
}
示例7: val
public function val()
{
$this->db->select('*');
$this->db->from('regi');
$query = $this->db->val();
return $query->result();
print_r(result());
}
示例8: query
function query($sql, $callback){
$result = result($sql);
echo "<br>";
while ($row = mysql_fetch_array($result)) { call_user_func($callback, $row); }
}
示例9: validate
function validate($name, $password)
{
$CI =& get_instance();
$query = $this->db->query("SELECT id, username, password FROM USERS WHERE username = '{$name}' && password = '{$password}'");
if (count($query) > 0) {
return $query . result();
}
return false;
}
示例10: loginit
function loginit($logfile)
{
global $lang;
showjsmessage($lang['init_log'] . ' ' . $logfile);
$fp = @fopen('./forumdata/logs/' . $logfile . '.php', 'w');
@fwrite($fp, '<' . '?PHP exit(); ?' . ">\n");
@fclose($fp);
result(1, 1, 0);
}
示例11: getFormno
function getFormno()
{
$reg = result("SELECT formno as reg FROM `formgen` ");
if (isset($reg[0]['reg'])) {
mysql_query("UPDATE `formgen` SET `formno`='" . (int) ($reg[0]['reg'] + 1) . "'");
return $reg[0]['reg'] + 1;
} else {
return 100001;
}
}
示例12: fib
function fib($x, $y, $term)
{
$fib = bcadd($x, $y);
$term += 1;
if (strlen($fib) >= 1000) {
echo "Term is " . $term . "\n";
result('4782', $term);
} else {
fib($y, $fib, $term);
}
}
示例13: main
function main($argv)
{
$time_start_all = microtime(true);
$save = getcwd();
$argument_list = get_args($argv);
//print_r($argument_list);
if ($argument_list == 0) {
return 0;
}
if (isset($argument_list['argv']['clean'])) {
if (chdir($_SERVER['TMPDIR']) == TRUE) {
if (file_exists($_SERVER['TMPDIR'] . 'no_x')) {
system("rm -R no_x");
echo 'Succès de la suppression', "\n";
} else {
echo 'Echec de la suppression. Le dossier n\'éxiste peut être pas ?' . "\n";
}
} else {
echo 'Echec de la suppression des fichiers temporaires' . "\n";
}
return 0;
}
$exist = false;
chdir($_SERVER['TMPDIR']);
if (!file_exists($_SERVER['TMPDIR'] . 'no_x')) {
mkdir($_SERVER['TMPDIR'] . 'no_x');
}
chdir($_SERVER['TMPDIR'] . 'no_x/');
if (!is_writable('~' . $argument_list['cible'] . '_' . $argument_list['source']) || !isset($argument_list['argv']['fast'])) {
chdir($save);
$list_dico = get_dico_array($time_start_message, $time_end_message, $argument_list['source']);
$messages = get_message_array_and_display($sort_time_start, $sort_time_end, $time_end_all, $result, $time_start, $time_end, $time_start_display, $time_end_display, $argument_list['cible'], $list_dico);
$time_end_all = microtime(true);
$time = $time_end - $time_start;
$time_all = $time_end_all - $time_start_all;
$time_message = $time_end_message - $time_start_message;
$time_display = $time_end_display - $time_start_display;
$sort_time = $sort_time_end - $sort_time_start;
result($sort_time, $time, $time_all, $time_message, $time_display);
echo count($list_dico), ' valeurs trouve dans le dictionnaire.', "\n";
echo $messages;
cache_generator("~" . $argument_list['cible'] . '_' . $argument_list['source'], $result);
} else {
chdir($_SERVER['TMPDIR']);
if (!file_exists($_SERVER['TMPDIR'] . 'no_x')) {
mkdir($_SERVER['TMPDIR'] . 'no_x');
}
chdir($_SERVER['TMPDIR'] . 'no_x/');
cache_receiver('~' . $argument_list['cible'] . '_' . $argument_list['source'], $select_time, $display_time);
$time_end_all = microtime(true);
$time_all = $time_end_all - $time_start_all;
result_cache($select_time, $display_time, $time_all);
}
}
示例14: cargarAgente
public function cargarAgente()
{
$query = $this->db->query("SELECT * \r\n FROM agente where estatus=1");
$resultado = array();
if ($query->num_rows() > 0) {
foreach ($query->result() as $row) {
$resultado[] = $row;
}
return $resultado;
$query->free - result();
}
}
示例15: obtenerProcedimientoTicket
public function obtenerProcedimientoTicket($ticket, $sector, $ente)
{
$sql = "SELECT DISTINCT act.id actividadid, act.descripcion actividad, actf.funcionario idfuncionario, CASE tact.estatus\r\n WHEN 0 THEN 'ELIMINADO'\r\n WHEN 1 THEN 'PENDIENTE'\r\n WHEN 3 THEN 'EN ESPERA'\r\n WHEN 2 THEN 'RECIBIDO'\r\n\t\t\t\t WHEN 4 THEN 'APROBADO'\r\n WHEN 5 THEN 'RECHAZADO' END as estatus, \r\n tact.observacionresponsable observacionfuncionario, tact.observacionrespuesta respuestafuncionario, \r\n CONCAT(p.nombre, ' ', p.apellido) encargado\r\n FROM ticket_actividad tact \r\n INNER JOIN actividad act ON tact.actividad=act.id \r\n INNER JOIN actividad_funcionario actf ON act.id=actf.actividad \r\n INNER JOIN funcionario f ON f.id=actf.funcionario\r\n INNER JOIN persona p ON p.id=f.persona\r\n INNER JOIN tramite t ON t.id=act.tramite\r\n INNER JOIN sector_tipoayuda sta ON t.sector_tipoayuda=sta.id \r\n INNER JOIN ente_sector es on es.sector= sta.sector \r\n INNER JOIN tramite_funcionario tfn on tfn.tramite=t.id\r\n INNER JOIN funcionario fn on tfn.funcionario=fn.id \r\n WHERE tact.ticket={$ticket} and sta.sector={$sector} and fn.ente={$ente} ";
$query = $this->db->query($sql);
if ($query->num_rows() > 0) {
foreach ($query->result() as $row) {
$resultado[] = $row;
}
return $resultado;
$query->free - result();
}
}