|
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 |
Paris Smarty Rookie
Joined: 02 Dec 2009 Posts: 13
|
Posted: Wed Feb 18, 2015 2:52 pm Post subject: Compare 2 arrays |
|
|
Hi,
I have a site with smarty and now i want to compare 2 arrays for unique values... tried everything but i can't get it write.
I have two database querys:
Code: | $winks = $osDB->getAll( 'SELECT ref_userid FROM ! ', array(VIEWS_WINKS_TABLE) );
$user = $osDB->getAll( 'SELECT id FROM ! ', array(USER_TABLE) ); |
and in my template foreach;
Code: | {foreach item=item key=key from=$winks}
<div>
userid = {$item.owner}<br /></div>{/foreach}
{foreach item=item key=key from=$user}
<div>
userid = {$item.id} <br /></div>{/foreach} |
it gives (shorten):
Code: |
userid = 957
userid = 94
----------------------------------------------------
userid = 2
userid = 94
userid = 95
userid = 176
userid = 179
|
I want to see if the id's 957 and 94 exists in the other string.. so in this case it must give 957 because that id das not exist in the other tabel.
I would appreciate al lot any help i get
regards
Paris |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
|
Back to top |
|
Paris Smarty Rookie
Joined: 02 Dec 2009 Posts: 13
|
Posted: Thu Feb 19, 2015 9:21 am Post subject: |
|
|
This is a smarty question.. the database query outcome is (shorten):
Code: | Array ( [0] => Array ( [owner] => 957 ) [1] => Array ( [owner] => 94 ) ) |
and
Code: | Array ( [0] => Array ( [id] => 2 ) [1] => Array ( [id] => 94 ) [2] => Array ( [id] => 95 ) [3] => Array ( [id] => 176 ) [4] => Array ( [id] => 179 ) [5] => Array ( [id] => 195 ) [6] => Array ( [id] => 197 ) [7] => Array ( [id] => 198 ) [8] => Array ( [id] => 200 ) ) |
nothing with the php array functions seems to work with this kind of array. |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Thu Feb 19, 2015 10:40 am Post subject: |
|
|
This is not a Smarty question. Smarty is a template engine.
To process your data, please use business logic of your application. |
|
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
|