473,472 Members | 2,191 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Array Lookup after fetch_all

Claus Mygind
571 Contributor
When I use

$x = $result->fetch_all($result = MYSQLI_NUM);

I get a multidimensional array, since each row is an array of columns and then the collection of rows is the outer array.

My problem is this, I want to scan the inner array's 2nd item for a value so I don't have to loop through the entire result set each time through.

Sample result set would look something like this

array(
array(
xxxx,
A
),
array(
yyyyy,
B
),
)

How can I scan for that 2nd value without looping?

I have tried array_search and array_intersect, but I am not able to construct the code properly.

Say I wanted to return the content of array that has "B", How would I do that?
Aug 27 '12 #1
2 1303
ariful alam
185 New Member
You can have a look here. http://www.w3schools.com/php/php_arrays.asp
Aug 27 '12 #2
Claus Mygind
571 Contributor
Yes I have looked at that before, but it is not what I am looking for. I think I will have to loop the query result once and store in an array which I will build.

Thanks for your help though
Aug 30 '12 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: Kristian Bisgaard Lassen | last post by:
Hi, How do I parameterize a template by a a allocated array of integers, which is declared static and constant, so I can make compile time optimizations depending on the content of the array....
13
by: Hans | last post by:
Hello, Thanks for all your response on my question about signed/unsigned chars. The problem is this: I want to use the char array for a ArrayLookup, so I need to convert char to unsigned int....
0
by: Gabriel | last post by:
I'm trying to build a short constant array (lookup table) into an assembly. Basically a dictionary of items and their extended meaning. The list is very short so I don't want to have to have to...
38
by: VK | last post by:
Hello, In my object I have getDirectory() method which returns 2-dimentional array (or an imitation of 2-dimentional array using two JavaScript objects with auto-handled length property - please...
9
by: Winston Li | last post by:
In the Brain and Denis' book "The C Programming Language" Section 5.3 "Pointes abd Arrays", a statment goes: "Any operation that can be achieved by array subscripting can also be done with...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.