473,404 Members | 2,114 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

Array Problem

10
$D['available_colors'] as 7, 6, 3, 1 coming from MySQL.

I have this array.

[PHP]
echo '<pre>';
print_r(explode(', ', $D['available_colors']));
echo '</pre>';
[/PHP]

Output:
Array
(
[0] => 7
[1] => 6
[2] => 3
[3] => 1
)

And i have color_id at another while.

I want this: If color_id == array() show result.

Sorry, my english bad.

Thanks
Nov 27 '06 #1
3 859
ronverdonk
4,258 Expert 4TB
You cannot compare a variable with an array. What you can do is check if a variable is present in the array. Like this:
[php]if (in_array($color_id, $array))
show result ....
[/php]

Ronald :cool:
Nov 27 '06 #2
Midgard
10
Thanks!! :)
Nov 27 '06 #3
ronverdonk
4,258 Expert 4TB
You are welcome.

Ronald :cool:
Nov 27 '06 #4

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

Similar topics

1
by: Robert | last post by:
Im having a problem with an array that is put into a session. I want to be able to remove any element, but when I loop through to display them, it doesnt work right. I believe its because of the...
2
by: Zenobia | last post by:
I have a problem. I need to look up several values stored in arrays. Each value is stored as a pair. The first (number) represents the probability of this item occurring. For instance, in the...
3
by: engartte | last post by:
Hi all, I did the solution with consultation of some experts on the following problem: Declare an array of length of 10 and read integers into the elements of the array from keyboard.Then...
2
by: farmer | last post by:
I need to populate a listbox of other listview with selected listview items.although the following code works perfecty I want to use an Array (for various reasons) for Each ListItem In...
0
by: helldiversafe-news | last post by:
Hi all, I will use a apache soap service with an .net c# client and have a problem with an complex array: <?xml version='1.0' encoding='UTF-8'?> <SOAP-ENV:Envelope...
2
by: julian_m | last post by:
let's say that I've an array like this: $AL_array = Array ( => Array ( => 1 ) , => Array ( => 2 ) , => Array ( => 3 ) , => Array ( => 4 ) , => Array ( => 1 ) , => Array ( => 2 )...
8
by: SpreadTooThin | last post by:
Basically I think the problem is in converting from a 32 bit integer to a 16 bit integer. I have two arrays: import array a = array.array('L', ) b = array.array('H', ) b = a
2
by: arda | last post by:
how i can put 2d array to a pointer? In the below program i am giving a first value to output_bit and then start to a loop and putting the new values to an another array as called newdata. But as i...
2
by: Toni | last post by:
I have ImageButton array. I have defined onClick event and it works. But in this function I can not use control propetries. I want to use index of ImageButton which is clicked and ImageURL...
3
by: Robert Bevington | last post by:
Hi all, I ran into memory problems while tying to search and replace a very large text file. To solve this I break the file up into chunks and run the search and replace on each chunk. This...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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,...
0
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...

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.