|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
cditty Smarty Rookie
Joined: 13 May 2003 Posts: 15
|
Posted: Wed Jun 18, 2003 7:46 pm Post subject: Dealing with multiple arrays |
|
|
I have 2 smarty arrays of IDs that I need to compare and only display the data IF there is no match in the array. I can't seem to get my head around it.
Example
Array 1
1
2
3
4
5
Array 2
1
3
5
I need to show the information that does not match in the arrays. Can anyone offer any advice?
Chris |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Wed Jun 18, 2003 8:20 pm Post subject: |
|
|
don't use smarty for that logic. use php:
Code: | $smarty->assign('difference', array_diff($a1, $a2)); |
and display that. |
|
Back to top |
|
cditty Smarty Rookie
Joined: 13 May 2003 Posts: 15
|
Posted: Fri Jun 20, 2003 1:32 pm Post subject: |
|
|
Thanks. Any suggestions on comparing arrays that are setup like this?
I did break the first array apart at the act_gmtr_id, but then I couldn't get the other information that I needed.
Chris
Array 1
Code: |
0 => Array (14)
0 => 9124cb7f878af48afff9859efcb3320c59b4f013
gmtr_id => 9124cb7f878af48afff9859efcb3320c59b4f013
1 => 100010
act_gmtr_id => 100010
2 => ADM GRAIN
gmtr_name => ADM GRAIN
3 => 1811 DOCK
gmtr_address => 1811 DOCK
4 => AVC 3.11
gmtr_version => AVC 3.11
5 => 1997-09-30 12:00:00
first_read_date => 1997-09-30 12:00:00
6 => 2003-06-19 07:00:00
last_read_date => 2003-06-19 07:00:00
|
Array 2
Code: |
Array (5)
0 => 100010
1 => 100030
2 => 100050
3 => 100062
4 => 100080
|
|
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|