Jump to content

dodgeitorelse3

Members
  • Posts

    158
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by dodgeitorelse3

  1. This doesn't use your api but if page is always formatted that way then possibly <?php //DOLLAR// $json_dolar=file_get_contents("https://mercados.ambito.com//dolar/informal/variacion"); $dolar=explode("\",", substr_replace(trim($json_dolar, '{}') ,"",-1)); echo trim(explode("\":\"", $dolar[4])[1])."<br><br>"; foreach($dolar as $key => $value){ echo $value." OR ".trim(explode("\":\"", $dolar[$key])[1])."<br>"; } ?> Which displays up "compra":"202,50 OR 202,50 "venta":"206,50 OR 206,50 "fecha":"04\/01\/2022 - 16:45 OR 04\/01\/2022 - 16:45 "variacion":"0,24% OR 0,24% "class-variacion":"up OR up
  2. You can read up on radio buttons at https://html5-tutorial.net/forms/radiobuttons/
  3. I ended up with this however I suppose a php memory issue will arise when enough data is retrieved. $all_data = array(); foreach($id as $idkey => $iduse){ $temparr=array(); $result_time = $conn->query("SELECT * FROM ".$iduse." order by timedate Asc"); while ($rowtime = $result_time->fetch_row()) { $temparr[] = $rowtime; } array_push($all_data, array("id" => $idonly[$idkey], "comment" => $comment[$idkey], "data" => $temparr)); } Also thank you Barand for the fetch_row replacement.
  4. Ok I am aware of the sins. The database I am using was created 18 years ago. The gsreaders database has a table labeled lgsl. This table houses all the details for each game server we track. There is an ID column for each server. Gsreaders database also has several other tables. 3 for each server. This is where the design issue comes into play. These tables have no columns in them to be able to use joins. The only way I know which 3 tables go to each server is by table name. So if for example a game server has ID 80 then the 3 corresponding tables use that I'd in the table name such as scoreboard_80_time. I am working on a page to allow users to look up data for a single server or all servers. This is why I get a list of all active servers and put the id's in an array. Then, for lack of knowledge I use another sin by running queries in the foreach. The globals were only there to see if it was an issue if not being able to pass data. Global will not be used. I used fetch row because each query result array must have the I'd of the server in final array so I know what data goes to which server as in the all_player_data array. Using fetch row as you suggested does not give me this. So my original question is still being asked. There are currently 20 active servers so there will be 20 all_player_data arrays. As each is made how do I push each to all_data array that is defined outside the foreach?
  5. I have a foreach statement that contains 20 values. with each value I run a query on tables to return results. I can get it to create an array but it only shows last foreach values returned results. How do I get all 20 results to be in $all_data array. my code so far is $all_data = array(); foreach($id as $idkey => $iduse){ global $all_data, $all_player_data, $temparr, $data; $all_player_data = array(); $temparr = array(); $result_time = $conn->query("SELECT * FROM ".$iduse." order by timedate Asc"); $temptdarray = array(); while ($rowtime = $result_time->fetch_row()) { $timedate = $rowtime[0]; // row 0 $numplayers = $rowtime[1]; // row 1 $maxplayers = $rowtime[2]; // row 2 $status = $rowtime[3]; // row 3 $players = $rowtime[4]; // row 4 $mapname = $rowtime[5]; // row 5 $maptype = $rowtime[6]; // row 6 $data = array("timedate" => $timedate, "numplayers" => $numplayers, "maxplayers" => $maxplayers, "status" => $status, "players" => $players, "mapname" => $mapname, "maptype" => $maptype); array_push($temparr, $data); } $all_player_data[] = array("id" => $idonly[$idkey], "comment" => $comment[$idkey], "data" => $temparr); array_push($all_data[], array($all_player_data)); } if I print_r($all_data) I get all_data Array ( [0] => [1] => [2] => [3] => [4] => [5] => [6] => [7] => [8] => [9] => [10] => [11] => [12] => [13] => [14] => [15] => [16] => [17] => [18] => [19] => ) if I print_r($all_player_data) I get all_player_data Array ( [0] => Array ( [id] => 80 [comment] => FooFire Attack Team [data] => Array ( [0] => Array ( [timedate] => 2021-03-17 16:34 [numplayers] => 0 [maxplayers] => 10 [status] => 1 [players] => [mapname] => SF Village Coop [maptype] => COOP ) [1] => Array ( [timedate] => 2021-03-20 07:12 [numplayers] => 1 [maxplayers] => 10 [status] => 1 [players] => --=P-51=-- [mapname] => SF Village Coop [maptype] => COOP ) [2] => Array ( [timedate] => 2021-03-20 07:26 [numplayers] => 2 [maxplayers] => 10 [status] => 1 [players] => --=P-51=--, [FFAT]herbstfuerst [mapname] => SF Village Coop [maptype] => COOP ) [3] => Array ( [timedate] => 2021-03-20 07:28 [numplayers] => 3 [maxplayers] => 10 [status] => 1 [players] => --=P-51=--, [FFAT]herbstfuerst, YAKIR [mapname] => SF Village Coop [maptype] => COOP ) .................blah blah blah [7223] => Array ( [timedate] => 2021-12-05 06:26 [numplayers] => 0 [maxplayers] => 10 [status] => 1 [players] => [mapname] => SF Village Coop [maptype] => COOP ) [7224] => Array ( [timedate] => 2021-12-05 07:26 [numplayers] => 0 [maxplayers] => 10 [status] => 1 [players] => [mapname] => SF Village Coop [maptype] => COOP ) [7225] => Array ( [timedate] => 2021-12-05 08:26 [numplayers] => 0 [maxplayers] => 10 [status] => 1 [players] => [mapname] => SF Village Coop [maptype] => COOP ) ) ) How do I get all 20 result sets into $all_data?
  6. you still have 20 hardcoded with y to show it as 2021. Instead of y use Y.
  7. seems to be a chrome browser bug. see https://bugs.chromium.org/p/chromium/issues/detail?id=1173575
  8. the ? is a separator which separates the url from the passed parameters typically passed from a form. https://www.php.net/manual/en/tutorial.forms.php
  9. I reread OP again and removed what I had posted bad info. My apologies.
  10. I see in your array that you printed out that there is an encoding issue (the diamonds with the question mark)
  11. Click the "at" in his reply
  12. I think your session_start () is in wrong place in AccountLinks.php
  13. If it is just for family or friends why not just use a login system to be able to post anything?
  14. No links for code please. Just insert your code here without any links.
  15. A web server typically uses port 80 so what do you get without the :5500 in address?
  16. in Firefox Developer menu bar choose Tools/Web Developer or right click on an element on web page and choose inspect element
  17. My apologies. I didn't see the commented out lines.
  18. You have a button with type= button as well as type= submit and name of remove and at sane time you have an input with type=submit and name=remove.
  19. pg_connect from manual https://www.php.net/manual/en/function.pg-connect.php
×
×
  • 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.