Jump to content

Minzer

New Members
  • Posts

    4
  • Joined

  • Last visited

Posts posted by Minzer

  1. Havent posted here in a while, been learning lots but im stuck on trying to unset/replace arrays that contain awkward key values.

     

    [0] => 2021-06-02T19:40:00Z
        [1] => 2021-06-03T02:10:00Z
        [2] => 2021-06-03T01:10:00Z
        [3] => 2021-06-02T23:05:00Z
        [4] => 2021-06-02T23:05:00Z
        [5] => 2021-06-02T23:07:00Z
        [6] => 2021-06-02T23:20:00Z
        [7] => 2021-06-02T18:20:00Z
        [8] => 2021-06-03T00:10:00Z
        [9] => 2021-06-03T00:40:00Z

    The json Im using is constantly updated, not sure why tmrw's dates June 3rd are at the top for their API design =[ Not good at regex. preg_replace/etc. Im desperate id use array search manually if I knew how to simple parse out tmrw's dates. I have unlimited API calls so I reckon  it don't matter, here's what Ive been playing with

    $oddsdata = 'https://pinnacle.datafeeds.net/api/json/odds/pinnacle/v3/60/baseball/mlb/moneyline?api-key=a71b8fe8e9eb957db549aaa5d99797a4'; 
    
    $readodds = file_get_contents($oddsdata);
    $odds = json_decode($readodds, true);
    $today = date("Y-m-d");
    $tmrw = date('Y-m-d', strtotime( $today . " +1 days"));
    
    foreach($odds['games'] as $key => $val):
    $gidRE[$key]["gid"] = $val["gameUID"]; 
    $startOdds[$key]["start"] = $val["startDate"]; 
    $homeTeams[$key]["hteam"] = $val["homeTeam"]; 
    $awayTeams[$key]["ateam"] = $val["awayTeam"]; 
    $Price[$key]["betPrice"] = $val["betPrice"]; 
    $BookOdds[$key]["book"] = $val["sportsbook"]; 
    $BetName[$key]["betName"] = $val["betName"]; 
    $Live[$key]["Live"] = $val["isLive"]; 
    endforeach;
    
    
    $endgidd = end(array_keys($gidRE)) + '1';
    $endz = end(array_keys($odds['games']));
    for ($l = 0; $l < $endz; ++$l) {
    $OddsAll[] = array_merge($gidRE[$l], $startOdds[$l], $homeTeams[$l], $awayTeams[$l], $Price[$l], $BetName[$l]);
    }

     

  2. $sql = "SELECT option_id, id FROM bets WHERE win_status = '1' AND updated_at BETWEEN '$today 13:00:00.000000' AND '$tmrw 08:00:00.000000'";
    $result = mysqli_query($connt, $sql);
    
    foreach($result as $value)
    {
    	$value[] = arary_multisort();
    	$oid = $value['option_id'];
    	$gid = $value['id'];
         var_dump($value);
         //$gim = var_export($value);
    }
    
    
    foreach($result as $key => $value) {
    
    	$info = array($value);
    
    }
    mysqli_close($connt);
    $fl = array($oid, $gid);
    print_r($fl);

    array (
      'option_id' => 'game1a',
      'id' => '155670450',
    )array (
      'option_id' => 'game2h',
      'id' => '386887537',

    Either I can return 1 row and have the data sorted nicely or I can return an array but I can only seem to access the last array. Been stuck on this bit for atleast 2 hrs sadly. How can I rename the array? Some days I might have 100 results. Today we have two winners xP I really need to ctrl+z sublime cuz I tried what feels like everything. Ancy to move to the next part of this code MATH if you can kindly assist.

    Yall have been extremely helpful in my last two posts 2/2 going on 3. Is there a place I can properly contribute lite silver :3

  3. //$value1 = $_POST['game'];
    
    $value1 = "game7h";
    
    if (strpos($value1, 'a')) {
    $team = 'a';
    }elseif (strpos($value1, 'h')) {
    $team = 'h';
    }      
    if (strpos($value1, '7')) {
    $num = '7';
    } elseif (strpos($value1, '8')) {
    $num = '8';
    } elseif (strpos($value1, '9')) {
    $num = '9';
    }
    
    $gm7hodds = $games[41]["BP"];
    $gm7aodds = $games[40]["BP"];
    
    $gm8hodds = $games[47]["BP"];
    $gm8aodds = $games[46]["BP"];
    
    $gm9hodds = $games[53]["BP"];
    $gm9aodds = $games[52]["BP"];
    
    
    /* 
    $getratio = $num + $team;
    
    echo $getratio;
    
    Team is not a math operation so I'll finesse that later.
    
    */
    
    
    $findratio = 'gm' . $num . 'h' . 'odds';
    echo $findratio;
    
    gm7hodds

    How would I add the $ to it and return its array value $gm7hodds?

    Solved whoops ->

    echo eval('return $'. $findratio. ';');

  4. <?php
    class CsvToArray {
    /*
    	global $file;
    	$file = '../Datafeeds/baseball_all.csv';
    */
    
    public function data() {
    $file = '../Datafeeds/baseball_all.csv';
    $fileName = fopen($file,'r+');
    $all_rows = array();
    $header = fgetcsv($fileName);
    while ($row = fgetcsv($fileName)) {
    $games[] = array_combine($header, $row);
      
    }
    //print_r($games);
    print_r($games[64]["Home Team"]);
    }
    }
    
    $game = new CsvToArray();
    $game->data();
    ?>

    csv: https://anonymousfiles.io/vSubWgPY/

    How can I get specific array values outside a class or function? About to try "File put contents" I think. That should work right? So I thought the last couple times. Or what would you suggest?. Overwritten previous attempts to share =[

     

    Next up is seeing if I can change $file to $var to change it from other locations. Should be easy I reckon.

  5. Been eyeing this board for a while. Ive finally arrived to hopefully get some assistance. Figured now or never. I'll try my best not be a noob.

    Upgraded from Php 7.3 to php 7.4 today and moved from mysql to mariadb. Seems I can't make arrays through the DB like I was doing, but I found a better more secure way lmao to just make arrays from csv's, fuckkin cant do it with json yet. Anyhow happy to be here cya about.

     

     

     

     

     

     

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.