Problem With Sql " Trying To Port A Mod" »  Show posts from    to     

Icy Phoenix


Old Support Topics - Problem With Sql " Trying To Port A Mod"



spydie [ Mon 10 Aug, 2009 21:34 ]
Post subject: 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: [Hide] [Select]
// 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);
}
}




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


As you see
The mod is calling Db by name and then the table prefix.


Mighty Gorgon [ Mon 10 Aug, 2009 21:56 ]
Post subject: 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 ]
Post subject: 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 ]
Post subject: Re: Problem With Sql " Trying To Port A Mod"
Well the error is self explaining... the table doesn't exist.

Check also that constants are defined properly.


spydie [ Mon 10 Aug, 2009 22:10 ]
Post subject: Re: Problem With Sql " Trying To Port A Mod"
you see this ??

SQL Error : 1146 Table 'ip.ip_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: [Hide] [Select]
// 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 .= '<option value="' . $row['group_id'] . '" ' . $selected . '>' . $row['group_name'] . '</option>';
}
$db->sql_freeresult($result);



And imagine the error:

Yes you got it:
Spoiler: [ Show ]


Mighty Gorgon [ Fri 14 Aug, 2009 11:05 ]
Post subject: Re: [SOLVED] Problem With Sql " Trying To Port A Mod"
spydie wrote: [View Post]
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

You are missing the quotes there...

Query should be as follows:

Code: [Hide] [Select]
"SELECT * FROM " . GROUPS_TABLE . " WHERE group_single_user = 0"




Powered by Icy Phoenix