Seite 1 von 1

array problem

Verfasst: 06.10.2004 14:18
von Dave
In der folgenden Version wird überprüft ob man zugangs rechte zu einem Forum hat um dann hinterher die letzten 20 Beiträge auszugeben.

Code: Alles auswählen

for ($i = 0; $i < count($forum_data); $i++)
		{
			$foren_id = $forum_data[$i]['forum_id'];
				if ((!$is_auth_ary[$forum_data[$i]['forum_id']]['auth_read']) or (!$is_auth_ary[$forum_data[$i]['forum_id']]['auth_view']))
				{
					if ($except_forum_id == '\'start\'')
					{
						$except_forum_id = $forum_data[$i]['forum_id'];
					}
					else
					{
						$except_forum_id .= ',' . $forum_data[$i]['forum_id'];
					}
				}
		}
Um ein paar foren auszuschließen habe ich es so geändert:

Code: Alles auswählen

$handel_array = array(43, 58, 59, 61, 62, 63, 64, 65);
		for ($i = 0; $i < count($forum_data); $i++)
		{
			$foren_id = $forum_data[$i]['forum_id'];
			if ( !in_array ( $foren_id, $handel_array) )
			{
				if ((!$is_auth_ary[$forum_data[$i]['forum_id']]['auth_read']) or (!$is_auth_ary[$forum_data[$i]['forum_id']]['auth_view']))
				{
					if ($except_forum_id == '\'start\'')
					{
						$except_forum_id = $forum_data[$i]['forum_id'];
					}
					else
					{
						$except_forum_id .= ',' . $forum_data[$i]['forum_id'];
					}
				}
			}
		}
nun bekomme ich aber den fehler:
Warning: in_array(): Wrong datatype for second argument in /srv/www/htdocs/web2/html/blocks/blocks_imp_recent_topics.php on line 61
Und das für jedes Forum :roll:
Weiß einer rat?


MfG
Dave

Verfasst: 07.10.2004 18:29
von Dave
^^push^^

Verfasst: 07.10.2004 22:14
von PhilippK
Ich seh da nichts :-?
Welche PHP-Version?

Gruß, Philipp

Verfasst: 08.10.2004 05:12
von Dave
4.3.9

Dave

Verfasst: 08.10.2004 06:57
von PhilippK
Hast du schon mal mit is_array den Datentyp geprüft?

Gruß, Philipp

Verfasst: 08.10.2004 13:02
von Blutgerinsel
var_dump();

Ausgabe?

Verfasst: 08.10.2004 13:54
von Dave
EDIT:

Code: Alles auswählen

for ($i = 0; $i < count($forum_data); $i++)
		{
			$foren_id = $forum_data[$i]['forum_id'];
			if ((!$is_auth_ary[$forum_data[$i]['forum_id']]['auth_read']) or (!$is_auth_ary[$forum_data[$i]['forum_id']]['auth_view']) or ( in_array ( $foren_id, array(43, 58, 59, 61, 62, 63, 64, 65)) ))
			{
				if ($except_forum_id == '\'start\'')
				{
					$except_forum_id = $forum_data[$i]['forum_id'];
				}
				else
				{
					$except_forum_id .= ',' . $forum_data[$i]['forum_id'];
				}
			}
		}
So klappt es :)