https://www.icyphoenix.com/viewtopic.php?f=35&t=6267 ----------------------------------- spydie Mon 10 Aug, 2009 21:34 Problem With Sql " Trying To Port A Mod" ----------------------------------- hi i got a small problem I´m trying to port F-1 Webtip Mod from .27 to 1.3 At the moment everything is fine but i have a problem with the table prefixes i got for example this code : [code linenumbers=false]// Pull all config data // $sql = "SELECT * FROM " . 'FORMEL_CONFIG_TABLE'; if(!$result = $db->sql_query($sql)) { message_die(GENERAL_ERROR, "Could not query config information in formel configuration", "", __LINE__, __FILE__, $sql); } else { while( $row = $db->sql_fetchrow($result) ) { $config_name = $row['config_name']; $config_value = $row['config_value']; $default_config[$config_name] = isset($HTTP_POST_VARS['submit']) ? str_replace("'", "\'", $config_value) : $config_value; $new[$config_name] = ( isset($HTTP_POST_VARS[$config_name]) ) ? $HTTP_POST_VARS[$config_name] : $default_config[$config_name]; if( isset($HTTP_POST_VARS['submit']) ) { $sql = "UPDATE " . 'FORMEL_CONFIG_TABLE'. " SET config_value = '" . str_replace("\'", "''", $new[$config_name]) . "' WHERE config_name = $config_name"; if( !$db->sql_query($sql) ) { message_die(GENERAL_ERROR, "Failed to update configuration for $config_name", "", __LINE__, __FILE__, $sql); } } } if( isset($HTTP_POST_VARS['submit']) ) { $message = $lang['formel_acp_config_updated'] . "

" . sprintf($lang['Click_return_config'], "", "") . "

" . sprintf($lang['Click_return_admin_index'], "", ""); message_die(GENERAL_MESSAGE, $message); } } [/code] and i get this error message : [quote]Could not query config information in formel configuration DEBUG MODE SQL Error : 1146 Table 'ip.ip_formel_config' doesn't exist SELECT * FROM ip_formel_config Line : 82 File : admin_formel_config.php[/quote] As you see The mod is calling Db by name and then the table prefix. ----------------------------------- Mighty Gorgon Mon 10 Aug, 2009 21:56 Re: Problem With Sql " Trying To Port A Mod" ----------------------------------- Are you sure you have created the table in your DB? Check also table prefix in phpMyAdmin. ----------------------------------- spydie Mon 10 Aug, 2009 21:57 Re: Problem With Sql " Trying To Port A Mod" ----------------------------------- checked that allready. the same happens then it tries to call GROUPS_table ----------------------------------- Mighty Gorgon Mon 10 Aug, 2009 21:59 Re: Problem With Sql " Trying To Port A Mod" ----------------------------------- Well the error is self explaining... the table doesn't exist. :wink: Check also that constants are defined properly. ----------------------------------- spydie Mon 10 Aug, 2009 22:10 Re: Problem With Sql " Trying To Port A Mod" ----------------------------------- you see this ?? SQL Error : 1146 Table '[b]ip.ip[/b]_formel_config' doesn't exist its calling ip.ip_ Edit: Need some glasses. Sh... Next sql error. And please don´t tell me the table does'nt exist That´s an standart table of IP and i´ve checked 5 times before posting my code : [code linenumbers=false]// Get all group data // $combo_groups_entries = ''; $sql = "SELECT * FROM " . 'GROUPS_TABLE'." WHERE group_single_user = 0"; if (!$result = $db->sql_query($sql)) { message_die(GENERAL_ERROR, 'Could not query groups data', '', __LINE__, __FILE__, $sql); } while ($row = $db->sql_fetchrow($result)) { $selected = ( $row['group_id'] == $new['restrict_to'] ) ? 'selected' : ''; $combo_groups_entries .= ''; } $db->sql_freeresult($result); [/code] And imagine the error: Yes you got it: [spoiler]Could not query groups data DEBUG MODE SQL Error : 1146 Table 'ip.groups_table' doesn't exist SELECT * FROM GROUPS_TABLE WHERE group_single_user = 0 Line : 139 File : admin_formel_config.php[/spoiler] ----------------------------------- Mighty Gorgon Fri 14 Aug, 2009 11:05 Re: [SOLVED] Problem With Sql " Trying To Port A Mod" ----------------------------------- [quote user="spydie" post="42646"]SQL Error : 1146 Table 'ip.groups_table' doesn't exist SELECT * FROM GROUPS_TABLE WHERE group_single_user = 0 Line : 139 File : admin_formel_config.php[/quote] You are missing the quotes there... Query should be as follows: [codeblock]"SELECT * FROM " . GROUPS_TABLE . " WHERE group_single_user = 0"[/codeblock]