Seite 1 von 1

Tabellen Update

Verfasst: 14.11.2006 16:14
von bgx
Hi!

Warum beschreibt er mir die Configtabelle nicht, wenn ich folgendes Script starte?

Code: Alles auswählen

$style = array(
        'default'=>'',
        '14.11.'=>'snowSilver',
        '06.01.'=>'subSilver'
    );

$now = date('d.m.');
$img = isset($style[$now]) ? $style[$now] : $style['default'];

if ($img='snowSilver')
{
if ( !file_exists($phpbb_root_path . 'cache/snowSilver.' . $phpEx) )
{
			$sql = "UPDATE " . CONFIG_TABLE . " SET
				config_value = '2'
				WHERE config_name = 'default_style'";
  $file_style = fopen ( $phpbb_root_path . 'cache/snowSilver.'.$phpEx, 'w');
  fwrite ( $file_style, "AKTIV" );
  fclose ( $file_style );
unlink ($phpbb_root_path . 'cache/config_table.'.$phpEx);
}}
//echo 'test<img src="', $img, '" alt="', $img,'/>';
else if ($img='subSilver')
{
if ( file_exists($phpbb_root_path . 'cache/snowSilver.' . $phpEx) )
{
			$sql = "UPDATE " . CONFIG_TABLE . " SET
				config_value = '1'
				WHERE config_name = 'default_style'";
unlink ($phpbb_root_path . 'cache/config_table.'.$phpEx);
unlink ($phpbb_root_path . 'cache/snowSilver.'.$phpEx);
}}
Wenn ich die gleiche SQL-Abfrage ausserhalb des if-Blocks setze, beschreibt er Sie.

ein echo innerhalb der if-Abfrage zeigt er korrekt an. :roll:

EDIT:

Diese Code ist sogar noch besser:

Code: Alles auswählen

$style = array(
        'default'=>'',
        '14.11.'=>'snowSilver',
        '06.01.'=>'subSilver'
    );

$now = date('d.m.');
$img = isset($style[$now]) ? $style[$now] : $style['default'];

if (($img='snowSilver') AND ( $board_config['default_style'] = '1' ))
{
			$sql = "UPDATE " . CONFIG_TABLE . " SET
				config_value = '2'
				WHERE config_name = 'default_style'";
unlink ($phpbb_root_path . 'cache/config_table.'.$phpEx);
}
else if (($img='subSilver') AND ( $board_config['default_style'] = '2' ))
{
			$sql = "UPDATE " . CONFIG_TABLE . " SET
				config_value = '1'
				WHERE config_name = 'default_style'";
unlink ($phpbb_root_path . 'cache/config_table.'.$phpEx);
}
Aber auch hier klappt es nicht mit dem SQL-Update der Config Tabelle

Verfasst: 14.11.2006 18:48
von bgx
Kann man zu machen!

Ich hab die SQL Anfrage vergessen auszuführen :lol: