Jump to content

jonnyenglish89

Members
  • Content Count

    16
  • Joined

  • Last visited

Community Reputation

0 Neutral

About jonnyenglish89

  • Rank
    Member
  1. Great, I'll make the changes. thank you for the advice!
  2. Hi, I’d appreciate some help with my homework. I’ve got to display each student’s name and the results for each of their modules using vanilla JavaScript. the following code displays the values I’m after, but I’d really like to know how to improve it. var data = { "students":[ { "name":"Eric Smith", "modules":{ "1":{ "id":"COMP40003", "name":"Software Development", "result":80 }, "2":{ "id":"COMP40001", "name":"Digital technologies",
  3. Thanks for the translation I could do with some help with 5b. I can remove the first instance of of the selected letter within the function selectNextNumber with unset($bestOrder[$x]) and return the updated $bestOrder array and $numberToPick is that a good way to do it or would you recommend somethingelse?
  4. Hi guys, I’d appreciate a little guidance but I’m gonna struggle to explain what the problem is first… so apologies in advance. $drawOrder is an array of 1 to 10 letters that are drawn at random Array ( [101] => C [102] => F [103] => D [104] => J [105] => B [106] => H [107] => I [108] => G [109] => E [110] => A ) $bestOrder contains the same values as $drawOrder but the letters are given a priori
  5. thank you very much for the help guys! Unfortunately, I’m unable to share the actual code ☹ but you’ve helped me nonetheless
  6. Thanks, but the above code is not the code I am using – I wrote that as a simple example of my problem. Taking away the class would mean changing a lot of code
  7. Hey guys, How can I access the $currentAccount and $numberOfAccounts variables from the construct function and use them in the updateDB function without making them global variables? <?php class Client { public function __construct($start = []) { ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); $sql = mysqli_connect('localhost', 'root', '', 'test'); $query = "SELECT * FROM users;"; $ret = mysqli_fetch_all(mysqli_query($sql, $query) , MYSQLI_ASSOC); $this->print(count($ret) . ' Accounts Loaded!'); $numberOfAccounts = (coun
  8. Hey guys how can i use php to turn a string like this: “A, B#2, C#2, D#3, E” Into an array like this: Array ( [1] => A [2] => B [3] => B [4] => C [5] => C [6] => D [7] => D [8] => D [9]=> E ) I can get the letter and count into an array like this with the help of regex: Array ( [A] => 1 => 2 [C] => 2 [D] => 3 [D]=> 1 ) But I have no idea how I would get the result I desire – any help with this part would be greatly appreciated
  9. Hey, I’m considering hiring someone to create an app that will act as an intermediary between tasks sent from a vps to a program on my PC which will return the results to the vps. What should I be searching for when researching the pros and con of something like this? Ps, the tasks are very CPU intensive else I wouldn’t consider using my PC.
  10. nevermind... $com_array = array_keys($main[0]); $com_id = $commander_array[0]; $dom_array = array_keys($main[1]); $dom_id = $dominion_array[0]; $cards = json_encode($main[2]); this does the trick.
  11. ok, I'm still stuck... I've tried this: foreach($main as $key => $value) { $t[] = array_keys($value); } $com_id = json_encode($t[0]); = [25256] $dom_id = json_encode($t[1]); = [50005] when I do a var_dump it says it's a string: string(7) "[25256]"what am I doing wrong?
  12. Hey guys, I needed to covert the $main array in to a string so I used json_encode to do it but now I’m unsure how to get just the key values for $main[0] and $main[1] – can anyone help? main array: Array ( [0] => Array ( [25256] => 1 ) [1] => Array ( [50005] => 1 ) [2] => Array ( [301] => 1 [2318] => 1 [13403] => 1 [49489] => 1 ) ) current code and output: $com_id = json_encode($main[0]); = {"25256":1} $dom_id = json_enco
×
×
  • 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.