View Full Version : arrrggg!
AN-net
04-18-2004, 10:56 PM
ok im using a database to store things for inside an array
here is my code:
if(in_array($bbuserinfo['usergroupid'], array($setting['whocanview_journals'])))
{
in the database it is 6,2. it only works if its just one number. anyone know why it isnt. note that if it passes to false it prints permission error. can someone please help?
assassingod
04-18-2004, 10:59 PM
You probably need to use the explode function (http://uk.php.net/manual/en/function.explode.php):
$whocanview = $setting['whocanview_journals'];
if (in_array($bbuserinfo['usergroupid'], explode(',', $whocanview)))
AN-net
04-19-2004, 12:16 AM
what would that do? it would just put the 6 and 2 together wouldnt it?
assassingod
04-19-2004, 12:18 AM
It'll take the , from the DB entry and make it work in that in_array.
AN-net
04-19-2004, 12:21 AM
k
AN-net
04-19-2004, 12:26 AM
still not working:(
$wcv= explode(',', $setting[whocanview_journals]);
if(in_array($bbuserinfo['usergroupid'], array($wcv)))
{
assassingod
04-19-2004, 01:40 AM
Just use:
$wcv = $setting['whocanview_journals'];
if (in_array($bbuserinfo['usergroupid'], explode(',', $wcv)))
{
Xenon
04-19-2004, 02:59 PM
This way by steve will work.
but to learn different ways doesn't hurt ;)
you can use this way as well:
eval("\$isingroup = in_array($bbuserinfo[usergroupid], array($setting[whocanview_journals]));");
if ($isingroup)
{....
Dean C
04-19-2004, 03:11 PM
Stop showing off Stefan ;) ^^
Xenon
04-19-2004, 03:26 PM
well, it doesn't hurt to learn new ways, does it? :p
AN-net
04-19-2004, 06:07 PM
oooo thats pretty:) thanks xeon;)
Xenon
04-19-2004, 08:08 PM
:)
you're welcome :)
and it's Xenon, not the cpu of some pc's ^^
AN-net
04-19-2004, 08:31 PM
woops sry :o
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.