Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/23/2020 in all areas

  1. With mysqli, when you use prepare() you get a statement object. The fetch_all() method you are using is a mysqli result object method (You get a result object when you use mysqli query() ). mysqli was built by two teams of developers who never spoke to one another, and so you get one set of methods for statements and a completely different set for results. Use PDO and this mess goes away.
    1 point
  2. try $temp = []; foreach ($cars as $car) { $qty = intval($car); $key = trim(strstr($car, ','), ','); if (!isset($temp[$key])) $temp[$key] = 0; $temp[$key] += $qty; } foreach ($temp as $k => $t) { $newcars[] = "$t,$k"; }
    1 point
  3. Going back a step, how are you creating that original array?
    1 point
  4. $('#sum').innerText That syntax mixes jQuery and plain Javascript which you cannot do. $('#sum') creates a jQuery object, but .innerText is a DOM property in plain javascript. The jQuery way to read/set the text value of an element is with the .text() method.
    1 point
This leaderboard is set to New York/GMT-04:00
×
×
  • 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.