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


PHP mysql_resultTo2DAssocArray_JGrid函数代码示例

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


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

示例1: foreach

         foreach ($row as $key => $value) {
             //$rowRet[] = $value;
             $ret[$i][$key] = $value;
         }
         //$ret[i] = $rowRet;
         $i++;
     }
     $ret2["dataset"] = $ret;
     echo json_encode($ret2);
     //exit;
 } elseif ($_GET['action'] == 'getCurrentTurtlePortfolio') {
     $query = $_GET['txtInputQuery'];
     $query = stripslashes($query);
     $result = queryMysql($query);
     $sightings = array();
     $sightings = mysql_resultTo2DAssocArray_JGrid($result);
     echo json_encode($sightings);
     exit;
 } elseif ($_GET['action'] == 'calculateEndBalance') {
     $transactionList = array();
     $beginBalance = 1000000;
     // get unique symbol from transaction table that has sell
     $query = "select symbol, trade_type, trade_date, shares, price from turtle_portfolio_transaction where portfolio_id = 1 order by trade_date asc ";
     $result = queryMysql($query);
     while ($data = mysql_fetch_row($result)) {
         if ($data[1] == 'BUY') {
             $beginBalance -= $data[3] * $data[4];
         } else {
             $beginBalance += $data[3] * $data[4];
         }
     }
开发者ID:jimmyc815,项目名称:algo,代码行数:31,代码来源:connorsRSI_strat_5.php

示例2: turtle_s2_system

                    $my_sql = "insert into turtle_s2_system (symbol, trade_date, trade_type, num_shares, ";
                    $my_sql .= "price_paid, current_N, stop_loss, next_buy_point, stop_loss_type, cash_balance, buy_type) ";
                    $my_sql .= "values ('" . $symbol . "', '" . $ph[$x]['trade_date'] . "', 'Sell', {$current_pos}, " . $stop_loss . ", ";
                    $my_sql .= "{$current_N}, 0, 0, '{$stop_loss_type}', {$cash_balance}, '{$buy_signal}') ";
                    $result = queryMysql($my_sql);
                    $current_pos = 0;
                    $pyramid_mode = 0;
                }
            }
        }
        $query = "select * from turtle_s2_system where symbol = '" . $symbol . "'";
        $query .= " and stop_loss_type = '{$stop_loss_type}' and buy_type = '{$buy_signal}'";
        $query = stripslashes($query);
        $result = queryMysql($query);
        $json_result = array();
        $json_result = mysql_resultTo2DAssocArray_JGrid($result);
        echo json_encode($json_result);
        exit;
    }
}
function get_stop_loss($type, $current_stop, $close_price, $day_high, $day_low, $high_55, $high_20, $low_20, $ma_50, $ma_200, $ATR)
{
    $stop = 0;
    if ($type == "ATR_1N") {
        $stop = $high_55 - $ATR;
    } else {
        if ($type == "ATR_2N") {
            $stop = $high_55 - 2 * $ATR;
        } else {
            if ($type == "8PCT") {
                $stop = $high_55 * 0.92;
开发者ID:jimmyc815,项目名称:algo,代码行数:31,代码来源:turtle_system.php


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