Hi Guys, I hope someone can help me with this, because i'm getting
crazy to find a good way to do that!
This is what I got by querying a db.
$arr1 = array("site", "descriptio n", "area1" , "activity1" );
$arr2 = array("site", "descriptio n", "area1" , "activity2" );
$arr3 = array("site", "descriptio n", "area2" , "activity2" );
$arr4 = array("site1", "descriptio n1", "area3" , "activity2" );
$my_array = array($arr1, $arr2, $arr3, $arr4);
Site and description are linked because they are in the same row of
the same table.
But every site can have 1 or more areas and every area can have 1 or
more activity.
I'd like to clean $my_array in a way I can have a compact one without
doubles
//pseudocode!
$new = array (
array('site','d escr') =array (
array('area','a ctivity')
)
);
Is it possible??
Thanks for your precious help
Francesco 5 1551 fl**@tluk.it wrote:
Hi Guys, I hope someone can help me with this, because i'm getting
crazy to find a good way to do that!
This is what I got by querying a db.
$arr1 = array("site", "descriptio n", "area1" , "activity1" );
$arr2 = array("site", "descriptio n", "area1" , "activity2" );
$arr3 = array("site", "descriptio n", "area2" , "activity2" );
$arr4 = array("site1", "descriptio n1", "area3" , "activity2" );
$my_array = array($arr1, $arr2, $arr3, $arr4);
Site and description are linked because they are in the same row of
the same table.
But every site can have 1 or more areas and every area can have 1 or
more activity.
I'd like to clean $my_array in a way I can have a compact one without
doubles
//pseudocode!
$new = array (
array('site','d escr') =array (
array('area','a ctivity')
)
);
Is it possible??
Thanks for your precious help
Francesco
Rather I think I'd make both the site name and the area indexes. You
can still access the keys of those items, and it will make building your
array much easier.
use something like:
$myarray = array($sitename =>
array('descript ion' =$description,
'area' =>
array($area =>'activities' =>
array($activity ))));
$sitename is the actual sitename retrieved from the database. This
would give you an array similar to
[site1] = Array {
[description] = First site's description
[area] = Array {
[area1] = Array {
[0] = first activity
[1] = second activity
}
}
}
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. js*******@attgl obal.net
=============== ===
On 30 Mag, 13:33, Jerry Stuckle <jstuck...@attg lobal.netwrote:
f...@tluk.it wrote:
Hi Guys, I hope someone can help me with this, because i'm getting
crazy to find a good way to do that!
This is what I got by querying a db.
$arr1 = array("site", "descriptio n", "area1" , "activity1" );
$arr2 = array("site", "descriptio n", "area1" , "activity2" );
$arr3 = array("site", "descriptio n", "area2" , "activity2" );
$arr4 = array("site1", "descriptio n1", "area3" , "activity2" );
$my_array = array($arr1, $arr2, $arr3, $arr4);
Site and description are linked because they are in the same row of
the same table.
But every site can have 1 or more areas and every area can have 1 or
more activity.
I'd like to clean $my_array in a way I can have a compact one without
doubles
//pseudocode!
$new = array (
array('site','d escr') =array (
array('area','a ctivity')
)
);
Is it possible??
Thanks for your precious help
Francesco
Rather I think I'd make both the site name and the area indexes. You
can still access the keys of those items, and it will make building your
array much easier.
use something like:
$myarray = array($sitename =>
array('descript ion' =$description,
'area' =>
array($area =>'activities' =>
array($activity ))));
$sitename is the actual sitename retrieved from the database. This
would give you an array similar to
[site1] = Array {
[description] = First site's description
[area] = Array {
[area1] = Array {
[0] = first activity
[1] = second activity
}
}
}
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attgl obal.net
=============== ===
Hey Jerry!
Many thanks for your help!
On May 30, 2:33 pm, "f...@tluk. it" <francesco.camp ana...@gmail.co m>
wrote:
On 30 Mag, 13:33, Jerry Stuckle <jstuck...@attg lobal.netwrote:
f...@tluk.it wrote:
Hi Guys, I hope someone can help me with this, because i'm getting
crazy to find a good way to do that!
This is what I got by querying a db.
$arr1 = array("site", "descriptio n", "area1" , "activity1" );
$arr2 = array("site", "descriptio n", "area1" , "activity2" );
$arr3 = array("site", "descriptio n", "area2" , "activity2" );
$arr4 = array("site1", "descriptio n1", "area3" , "activity2" );
$my_array = array($arr1, $arr2, $arr3, $arr4);
Site and description are linked because they are in the same row of
the same table.
But every site can have 1 or more areas and every area can have 1 or
more activity.
I'd like to clean $my_array in a way I can have a compact one without
doubles
//pseudocode!
$new = array (
array('site','d escr') =array (
array('area','a ctivity')
)
);
Is it possible??
Thanks for your precious help
Francesco
Rather I think I'd make both the site name and the area indexes. You
can still access the keys of those items, and it will make building your
array much easier.
use something like:
$myarray = array($sitename =>
array('descript ion' =$description,
'area' =>
array($area =>'activities' =>
array($activity ))));
$sitename is the actual sitename retrieved from the database. This
would give you an array similar to
[site1] = Array {
[description] = First site's description
[area] = Array {
[area1] = Array {
[0] = first activity
[1] = second activity
}
}
}
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attgl obal.net
=============== ===
Hey Jerry!
Many thanks for your help!
But really you should look at your DB and queries if you're getting
duplicates returned and fix it there.
C.
C. ( http://symcbean.blogspot.com/) wrote:
On May 30, 2:33 pm, "f...@tluk. it" <francesco.camp ana...@gmail.co m>
wrote:
>On 30 Mag, 13:33, Jerry Stuckle <jstuck...@attg lobal.netwrote:
>>f...@tluk.i t wrote: Hi Guys, I hope someone can help me with this, because i'm getting crazy to find a good way to do that! This is what I got by querying a db. $arr1 = array("site", "descriptio n", "area1" , "activity1" ); $arr2 = array("site", "descriptio n", "area1" , "activity2" ); $arr3 = array("site", "descriptio n", "area2" , "activity2" ); $arr4 = array("site1", "descriptio n1", "area3" , "activity2" ); $my_array = array($arr1, $arr2, $arr3, $arr4); Site and description are linked because they are in the same row of the same table. But every site can have 1 or more areas and every area can have 1 or more activity. I'd like to clean $my_array in a way I can have a compact one without doubles //pseudocode! $new = array ( array('site','d escr') =array ( array('area','a ctivity') ) ); Is it possible?? Thanks for your precious help Francesco Rather I think I'd make both the site name and the area indexes. You can still access the keys of those items, and it will make building your array much easier. use something like: $myarray = array($sitename => array('descript ion' =$description, 'area' => array($area =>'activities' => array($activity )))); $sitename is the actual sitename retrieved from the database. This would give you an array similar to [site1] = Array { [description] = First site's description [area] = Array { [area1] = Array { [0] = first activity [1] = second activity } } } -- ============= ===== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstuck...@att global.net ============= =====
Hey Jerry! Many thanks for your help!
But really you should look at your DB and queries if you're getting
duplicates returned and fix it there.
C.
No, it's quite possible to get duplicates in a 1-to-many situation. For
instance, one customer may have several invoices. You print out all of
the invoices for the month, and you may very easily get multiple entries
for a customer, each with a different invoice.
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. js*******@attgl obal.net
=============== ===
On May 30, 7:00 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
C. (http://symcbean.blogspot.com/) wrote:
On May 30, 2:33 pm, "f...@tluk. it" <francesco.camp ana...@gmail.co m>
wrote:
On 30 Mag, 13:33, Jerry Stuckle <jstuck...@attg lobal.netwrote:
>f...@tluk.it wrote: Hi Guys, I hope someone can help me with this, because i'm getting crazy to find a good way to do that! This is what I got by querying a db. $arr1 = array("site", "descriptio n", "area1" , "activity1" ); $arr2 = array("site", "descriptio n", "area1" , "activity2" ); $arr3 = array("site", "descriptio n", "area2" , "activity2" ); $arr4 = array("site1", "descriptio n1", "area3" , "activity2" ); $my_array = array($arr1, $arr2, $arr3, $arr4); Site and description are linked because they are in the same row of the same table. But every site can have 1 or more areas and every area can have 1 or more activity. I'd like to clean $my_array in a way I can have a compact one without doubles //pseudocode! $new = array ( array('site','d escr') =array ( array('area','a ctivity') ) ); Is it possible?? Thanks for your precious help Francesco Rather I think I'd make both the site name and the area indexes. You can still access the keys of those items, and it will make building your array much easier. use something like: $myarray = array($sitename => array('descript ion' =$description, 'area' => array($area =>'activities' => array($activity )))); $sitename is the actual sitename retrieved from the database. This would give you an array similar to [site1] = Array { [description] = First site's description [area] = Array { [area1] = Array { [0] = first activity [1] = second activity } } }
Hey Jerry!
Many thanks for your help!
But really you should look at your DB and queries if you're getting
duplicates returned and fix it there.
C.
No, it's quite possible to get duplicates in a 1-to-many situation. For
instance, one customer may have several invoices. You print out all of
the invoices for the month, and you may very easily get multiple entries
for a customer, each with a different invoice.
The task at hand is to get rid of duplicates in a list. So 'SELECT
DISTINCT customer....' or 'SELECT....GROU P BY Customer' - relational
DBMS and SQL were specifically designed for solving this kind of
problem - less code complexity and better performance than carrying
out the same task in PHP.
Yes, in another context these might not be duplicates, so use a
different query. But if they are always duplicates then the problem is
better solved by DDL and pre-empting occurrences.
C. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Russ Perry Jr |
last post by:
I'm using "ID" and "Value" in the generic sense here...
Let's say one page I had a <html:select> with a collection like this:
<html:options collection="items" property="key" labelProperty="value"/>
In this case "key" is what I mean by "ID", and "value" is what I mean
by "Value" -- the "Value" is shown to the user, but the "ID" is what
I plan to keep, to be saved to a database (as a reference in a table
to a common table as a part of...
|
by: PatchFactory Support |
last post by:
Description:
Professional and easy-to-use patch building environment that can help
you to create instant patch packages for software and file updating.
Generated patch packages are small size self-extracting executable
update programs in a famous installer style with adjustable
user-friendly interface and multilingual support.
Enhanced with features like easy-to-use interface including a Wizard
mode, powerful patch engine, integrated...
|
by: NBURGAN |
last post by:
We are currently searching for a reporting tool with graphics for our
end users who are using Oracle's standard edition. We are not using
the Oracle's AS. The tool needs to be easy to use and easy to learn.
We currently use Crystal Reports. Thanks. NBurgan
|
by: Canon EOS |
last post by:
Hi,
I am really new in .net and pocket PC development.
My background are purely C/C++/VC++. Have developed on Mobile Java for a
year and felt completely insecure with it because all codes can easily
uncompiled.
And it is why I am trying on .net for smartphone and PocketPC devices.
|
by: Adam Clauss |
last post by:
I have a folder containing many subfolders (and subfolders and....) all containing various .cs files. Is there any "easy" way to
get them all added to the solution. Preferable would be that the folders are actually created in the Solution Explorer so that I
can find things easily.
Its easy to select multiple files out of a single folder, but not recursively into subfolders.
Any ideas?
--
Adam Clauss
| |
by: Thomas |
last post by:
Hi,
I there anybody here that are designing applications with asp.net without
html in aspx files?
The problem is that aspx files is a dependency, and I would like to avoid
having that dependency for easy deployment. Ideally - I would like a single
binary or two to contain all resources - graphics etc - is that possible?
- Thomas
|
by: LedZep |
last post by:
What up,
All I need to do is enter a last name in a text box, query a MSAccess
database and display the name with the corresponding columns. This is
no problem, but when there are more than one records with the same
last name, I need to click a command button to display the next record
with that name. I cant find it in any of my books and it sounds like
an easy enough question. Any help is definately appreciated.
TIA,
|
by: Mad Scientist Jr |
last post by:
can someone explain how to simply populate a grid in .net ? the way i
understand it, there is no more msflexgrid, and instead is this new
control that has to be tied to a dataset, and it is a real pain to
work with if you just want to throw some values in a grid and edit
them with a textbox. i don't want to persist anything in a database, i
just need a fast cheap and easy grid in memory that i can work with!
i had functions in vb6 that...
|
by: Ghislain Tanguay |
last post by:
I have a compiled vb.net app and I want to give the user a choice to launch
it from the start line command and pass it a parameter or not. How can I do
that in my code? Is it possible?
Ex. : MyApp.exe "Go"
|
by: jacob navia |
last post by:
I am trying to compile as much code in 64 bit mode as
possible to test the 64 bit version of lcc-win.
The problem appears now that size_t is now 64 bits.
Fine. It has to be since there are objects that are more than 4GB
long.
The problem is, when you have in thousands of places
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |