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


PHP DBQuery::return_value_from_sql方法代码示例

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


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

示例1: debug

} else {
    $sql = "INSERT INTO debug (content, date) values ('" . mysql_real_escape_string($short) . "', '{$date}');";
    mysql_query($sql);
}
$requesta = json_decode(urldecode($_POST['payload']), true);
$id = $requesta['data']['ushahidi_id'];
$randIdent = $requesta['data']['randIdent'];
$message = $requesta['data']['sms_text'];
if ($id == '') {
    $sql = "INSERT INTO debug (content, date) values ('BAD ID: " . mysql_real_escape_string($short) . "', '{$date}');";
    mysql_query($sql);
    print "no id\n";
    die;
}
$sql = "SELECT location_name FROM location JOIN incident ON incident.location_id = location.id WHERE incident.id = {$id};";
$current_loc_name = DBQuery::return_value_from_sql($sql);
if ($current_loc_name != $unknown_loc && $current_loc_name != '') {
    // SOMEONE HAS SET THIS LOCATION WHILE BEING PROCESSED AT CF: ignore CF.
    print "\n<p>Location {$current_loc_name} already exists in Ushahidi instance<p>\n";
    die;
}
$sql = "SELECT randomIdentifier FROM incident_automated WHERE idIncident = '{$id}' AND randomIdentifier = '" . $randIdent . "'; ";
$matchRand = DBQuery::values_exist($sql);
if (!$matchRand) {
    print "nomatching rand\n{$sql}\n";
    $sql = "INSERT INTO debug (content, date) values ('BAD RAND: incident_id = {$id} for " . mysql_real_escape_string($short) . "', '{$date}');";
    mysql_query($sql);
    //die; #security - ignore requests where the random identifier isnt the one we gave for this task
    // repress this for now and continue: some ids changed post-migration
}
$sql = "UPDATE incident_automated SET returned_json = '" . mysql_real_escape_string($_POST['payload']) . "', status = '2' WHERE idIncident = '{$id}'";
开发者ID:unthinkingly,项目名称:ushahidi-crowdflower-plugin,代码行数:31,代码来源:index.php

示例2: return_value

 /**
  * returns the value of $ret_field if a record with $field = $value exists in the given $table
  * return an empty string otherwise
  */
 public static function return_value($field, $value, $table, $ret_field)
 {
     $sql = "SELECT {$ret_field} FROM {$table} WHERE {$field} = '{$value}';";
     print "{$sql}";
     return DBQuery::return_value_from_sql($sql);
 }
开发者ID:unthinkingly,项目名称:ushahidi-crowdflower-plugin,代码行数:10,代码来源:includes.php


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