bonjour je seche total sur un script de verification d'installation qui me retourne une erreur sql lorsque j'installe mon extension .
JDatabaseMySQL::query: 1146 - Table 'test3.hbgiv_components' doesn't exist SQL=UPDATE hbgiv_components SET admin_menu_img = '../components/com_test/media/test_logo.png' WHERE admin_menu_link = 'option=com_test'.
voici mon code ;
function com_install()
{
$db =& JFactory::getDBO();
//check if it is a fresh install
$sql = "SELECT data FROM #__test_preferences WHERE pref = 'version'";
$db->setQuery($sql);
$installed_version = $db->query();
if ($installed_version == "")
{
//check if #__test already exists
$sql = "SELECT COUNT(*) FROM #__test";
$db->setQuery($sql);
$table_rows = $db->loadResult();
if (!$table_rows)
{
$installed_version = 0;
}
else
{
if ($table_rows == 0)
{
$installed_version = 0;
}
else
{
$installed_version = 9999999999;
}
}
}
//set menu image
$sql = "UPDATE #__components "
. "SET admin_menu_img = '../components/com_test/media/test_logo.png' "
. "WHERE admin_menu_link = 'option=com_test' "
;
$db->setQuery($sql);
$db->query();
JDatabaseMySQL::query: 1146 - Table 'test3.hbgiv_components' doesn't exist SQL=UPDATE hbgiv_components SET admin_menu_img = '../components/com_test/media/test_logo.png' WHERE admin_menu_link = 'option=com_test'.
voici mon code ;
function com_install()
{
$db =& JFactory::getDBO();
//check if it is a fresh install
$sql = "SELECT data FROM #__test_preferences WHERE pref = 'version'";
$db->setQuery($sql);
$installed_version = $db->query();
if ($installed_version == "")
{
//check if #__test already exists
$sql = "SELECT COUNT(*) FROM #__test";
$db->setQuery($sql);
$table_rows = $db->loadResult();
if (!$table_rows)
{
$installed_version = 0;
}
else
{
if ($table_rows == 0)
{
$installed_version = 0;
}
else
{
$installed_version = 9999999999;
}
}
}
//set menu image
$sql = "UPDATE #__components "
. "SET admin_menu_img = '../components/com_test/media/test_logo.png' "
. "WHERE admin_menu_link = 'option=com_test' "
;
$db->setQuery($sql);
$db->query();
Commentaire