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 :
// 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'] . "<br /><br />" . sprintf($lang['Click_return_config'], "<a href=\"" . append_sid('admin_formel_config.'. PHP_EXT) . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid('index.'. PHP_EXT.'?pane=right'.PHP_EXT) . "\">", "</a>");
message_die(GENERAL_MESSAGE, $message);
}
}
//
$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'] . "<br /><br />" . sprintf($lang['Click_return_config'], "<a href=\"" . append_sid('admin_formel_config.'. PHP_EXT) . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid('index.'. PHP_EXT.'?pane=right'.PHP_EXT) . "\">", "</a>");
message_die(GENERAL_MESSAGE, $message);
}
}
and i get this error message :
Quote:
As you see
The mod is calling Db by name and then the table prefix.