- 0
Breaking my head on a multi-dimensional array
-
Recently Browsing 0 members
- No registered users viewing this page.
-
Posts
-
By TheGodOfKratos · Posted
Still 3x what it should cost. So, it seems the trick is to increase price by 6x so that a reduction in price back to 4x looks like a steal. "You savvy shoppers win again!" I'm glad I'm not in a desperate spot to actually even need this overpriced crap. Hopefully, it comes back down by the time for when (or if) I ever do. -
By Noveed · Posted
No M1? Wow! -
By Noveed · Posted
Although AI is great and has it's use cases they likely have massively overhyped it and it has not delivered as per their expectations. I fully expect them to start saying the same things again when it does get to a certain level of intelligence! -
By Usama Jawad96 · Posted
Microsoft wants to end printer driver headaches with Windows Ready Print by Usama Jawad A few days ago, Microsoft released Windows 11 Experimental build 26300.8553, bringing a ton of enhancements such as Start menu customization, search improvements, Taskbar polish, and other minor UI tweaks. Another relatively major enhancement snuck deep within the change log was related to upgrades to the Windows printing experience. Now, Microsoft has shared more details about these benefits. For starters, Microsoft has renamed its Modern Print Platform to Windows Ready Print. The company believes that this name highlights its shift in strategy, which now focuses on modernizing, securing, and streamlining the printing experience for Windows devices. Some of the upgrades present in Windows Ready Print have already been seeded to customers and partners. This includes ending support for third-party printer drivers via Windows Update and transitioning towards the Internet Printing Protocol (IPP) and the native Windows IPP printer driver. In line with these changes, new printer installations will default to Windows Ready Print on eligible devices starting from July 2026. However, Microsoft recognizes that not all environments will be able to migrate to this platform immediately, so it will allow users to choose between installing the printer via Windows Ready Print or the traditional OEM process. Users will be able to toggle this configuration through Settings > Bluetooth & Devices > Printers & Scanners > Printer preferences. This control applies only to new printer installations, and its functionality can also be modified via Group Policy as follows: Launch Group Policy Editor Navigate to Local Computer Policy -> Administrative Templates -> Printers Find and select 'Configure Windows Ready Print driver ranking' -> double click to open it Select 'Enabled' (if you wish to enable Windows Ready Print driver selection) or 'Disabled' (if you wish to explicitly disable Windows Ready Print driver selection). Select Apply Select OK Similarly, if you set up Windows protected print mode through the same setting in Windows 11, it will also default to using Windows Ready Print exclusively. Microsoft hopes that these improvements will help eradicate dependency on OEM-specific driver installation processes and simplify printer installations. We'll likely find out more about other tangible benefits in the coming months. -
By IATW · Posted
Hey what's about the proton vpn firefox extension ? It's not working today
-
-
Recent Achievements
-
Primer1st earned a badge
One Year In
-
JayZJay went up a rank
Experienced
-
Sir_Timbit earned a badge
Reacting Well
-
rubentuben8 earned a badge
Week One Done
-
ARaclen earned a badge
Week One Done
-
-
Popular Contributors
-
Tell a friend
Question
Jose_49
Hi people! I've been trying to get a receipt # from a database and building up an array with it.
I've modified the code, at least 5 times to make it work, but I need a last push, and I can't seem to get it:
Explaining:
The code is trying to do the following:
Create an array which first keys are the receipt number, and to that receipt number add all the products that were fetched from the database.
What I'm getting:
The array is being currently overwrote by the last receipt #. I know that the root of all this evil is this portion of the code:
if(!in_array($factura,$this->trigger)) $this->trigger[] = $factura;
[b] $this->factura = [/b]array($factura => array('producto_id' => array($row['producto_id']),
'producto' => array($row['producto']),
'cantidad' => array($row['cantidad']),
'price_i' => array($row['price_i']),
'tax' => array($row['tax'])
)
);
[/CODE]
The bold part should actually be:
$this->factura[] =
[/CODE]
But by doing so, the whole schema breaks, and the receipts are not appended in order.
Now, in English:
The result I'm getting without any mods:
Array
(
[4] => Array
(
[producto_id] => Array
(
[0] => E5030
[1] => E5060
[2] => E0094
[3] => E7485
)
[producto] => Array
(
[0] => Product # 1
[1] => Product # 2
[2] => Product # 3
[3] => Product # 4
)
[cantidad] => Array
(
[0] => 1
[1] => 1
[2] => 1
[3] => 1
)
[price_i] => Array
(
[0] => 286.62
[1] => 301.92
[2] => 153
[3] => 481
)
[tax] => Array
(
[0] => 1
[1] => 1
[2] => 1
[3] => 1
)
)
)
[/CODE]
WHICH IS GOOD, but the other receipts are overwritten.
But if I made the change I was talking about before, I'd get:
Array
(
[0] => Array
(
[1] => Array
(
[producto_id] => Array
(
[0] => A4318
)
[producto] => Array
(
[0] => Product name
)
[cantidad] => Array
(
[0] => 1
)
[price_i] => Array
(
[0] => 771.12
)
[tax] => Array
(
[0] => 0
)
)
)
[1] => Array
(
[producto_id] => Array
(
[0] => 102992
)
[producto] => Array
(
[0] =>Product name
)
[cantidad] => Array
(
[0] => 1
)
[price_i] => Array
(
[0] => 1128.12
)
[tax] => Array
(
[0] => 0
)
)
[2] => Array
(
[2] => Array
(
[producto_id] => Array
(
[0] => A5816
)
[producto] => Array
(
[0] => Product name
)
[cantidad] => Array
(
[0] => 1
)
[price_i] => Array
(
[0] => 630.36
)
[tax] => Array
(
[0] => 0
)
)
)
[3] => Array
(
[4] => Array
(
[producto_id] => Array
(
[0] => E5030
)
[producto] => Array
(
[0] => Product name
)
[cantidad] => Array
(
[0] => 1
)
[price_i] => Array
(
[0] => 286.62
)
[tax] => Array
(
[0] => 1
)
)
)
[4] => Array
(
[producto_id] => Array
(
[0] => E5060
[1] => E0094
[2] => E7485
)
[producto] => Array
(
[0] => Product name
[1] => Product name
[2] => Product name
)
[cantidad] => Array
(
[0] => 1
[1] => 1
[2] => 1
)
[price_i] => Array
(
[0] => 301.92
[1] => 153
[2] => 481
)
[tax] => Array
(
[0] => 1
[1] => 1
[2] => 1
)
)
)
Array
[/CODE]
What I'm really after:
Array
(
[1] => Array
(
[producto_id] => Array
(
[0] => E5030
)
[producto] => Array
(
[0] => Product # 1
)
[cantidad] => Array
(
[0] => 1
)
[price_i] => Array
(
[0] => 286.62
)
[tax] => Array
(
[0] => 1
)
)
)
Array
(
[2] => Array
(
[producto_id] => Array
(
[0] => E5030
[1] => E5060
)
[producto] => Array
(
[0] => Product # 1
[1] => Product # 2
)
[cantidad] => Array
(
[0] => 1
[1] => 1
)
[price_i] => Array
(
[0] => 286.62
[1] => 301.92
)
[tax] => Array
(
[0] => 1
[1] => 1
)
)
)
Array
(
[4] => Array
(
[producto_id] => Array
(
[0] => E5030
[1] => E5060
[2] => E0094
[3] => E7485
)
[producto] => Array
(
[0] => Product # 1
[1] => Product # 2
[2] => Product # 3
[3] => Product # 4
)
[cantidad] => Array
(
[0] => 1
[1] => 1
[2] => 1
[3] => 1
)
[price_i] => Array
(
[0] => 286.62
[1] => 301.92
[2] => 153
[3] => 481
)
[tax] => Array
(
[0] => 1
[1] => 1
[2] => 1
[3] => 1
)
)
)
[/CODE]
**Note that the 3 is missing on purpose because the receipt's number does not belong to the user I'm currently fetching on the database.
I know this post is looooooooooooooooooooooooooooooooooooong, but if someone could give me a little help I'd appreciate it a lot! Thanks :D
Link to comment
https://www.neowin.net/forum/topic/1128314-breaking-my-head-on-a-multi-dimensional-array/Share on other sites
2 answers to this question
Recommended Posts