chery Posted November 19, 2007 Share Posted November 19, 2007 Parse error: syntax error, unexpected '[', expecting ']' in /home/worldwid/public_html/admin/admin_arcade.php on line 47 Can anyone see the error and how to fix it? // // Load DB // $build_array = array(); $sql = "SELECT * FROM FROM phpbb_iNA; $result = $db->sql_query($sql); $ina_info = $db->sql_fetchrowset($result); foreach ($ina_info as $key => $value) { $build_array[$value['config_name']] = $value['config_value']; } unset($ina_info); $arcade_config = $build_array; // line 47 is $build_array[$value['config_name']] = $value['config_value']; Link to comment https://forums.phpfreaks.com/topic/77889-solved-syntax-error/ Share on other sites More sharing options...
bri0987 Posted November 19, 2007 Share Posted November 19, 2007 You forgot the single quotes... see below $build_array[ ' $value['config_name'] ' ] = $value['config_value']; Link to comment https://forums.phpfreaks.com/topic/77889-solved-syntax-error/#findComment-394250 Share on other sites More sharing options...
rajivgonsalves Posted November 19, 2007 Share Posted November 19, 2007 nothing looks wrong with your code but try this $build_array["{$value['config_name']}"] = $value['config_value']; Link to comment https://forums.phpfreaks.com/topic/77889-solved-syntax-error/#findComment-394252 Share on other sites More sharing options...
chery Posted November 19, 2007 Author Share Posted November 19, 2007 You forgot the single quotes... see below $build_array[ ' $value['config_name'] ' ] = $value['config_value']; Your suggestion gave this error: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/worldwid/public_html/admin/admin_arcade.php on line 47 Link to comment https://forums.phpfreaks.com/topic/77889-solved-syntax-error/#findComment-394258 Share on other sites More sharing options...
chery Posted November 19, 2007 Author Share Posted November 19, 2007 nothing looks wrong with your code but try this $build_array["{$value['config_name']}"] = $value['config_value']; Your suggestion gave this error: Parse error: syntax error, unexpected '"', expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/worldwid/public_html/admin/admin_arcade.php on line 47 Link to comment https://forums.phpfreaks.com/topic/77889-solved-syntax-error/#findComment-394261 Share on other sites More sharing options...
wsantos Posted November 19, 2007 Share Posted November 19, 2007 $sql = "SELECT * FROM FROM phpbb_iNA"; Forgot the qoutes. Link to comment https://forums.phpfreaks.com/topic/77889-solved-syntax-error/#findComment-394262 Share on other sites More sharing options...
chery Posted November 19, 2007 Author Share Posted November 19, 2007 $sql = "SELECT * FROM FROM phpbb_iNA"; Forgot the qoutes. Warning: Invalid argument supplied for foreach() in /home/worldwid/public_html/admin/admin_arcade.php on line 45 Parse error: syntax error, unexpected '[', expecting ']' in /home/worldwid/public_html/admin/admin_arcade_log.php on line 37 Link to comment https://forums.phpfreaks.com/topic/77889-solved-syntax-error/#findComment-394267 Share on other sites More sharing options...
chery Posted November 19, 2007 Author Share Posted November 19, 2007 It began throwing these errors when I had to change the original code from $build_array = array(); $sql = "SELECT * FROM " . iNA; to $build_array = array(); $sql = "SELECT * FROM phpbb_iNA; Link to comment https://forums.phpfreaks.com/topic/77889-solved-syntax-error/#findComment-394268 Share on other sites More sharing options...
chery Posted November 19, 2007 Author Share Posted November 19, 2007 Changed $sql = "SELECT * FROM phpbb_iNA; To $sql = "SELECT * FROM " . $table_prefix . "ina_data"; and it worked. Link to comment https://forums.phpfreaks.com/topic/77889-solved-syntax-error/#findComment-394273 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.