1
iHackCode
[Solved!]man whats wrong with my oninstall function.?

man im getting a headache trying to figure out why this doesnt work.

xoops_version... $modversion['oninstall'] = "oninstall.php";
file is oninstall.php
function xoops_module_install_xmspotlight(&$module){    
    global 
$xoopsDB;

    
//add field in stories table for link to img for article or spotlight.
    
if (!FieldExists('imgspotlight',$xoopsDB->prefix('stories'))) {
    
$result =    $xoopsDB->query("ALTER TABLE ".$xoopsDB->prefix('stories'). " ADD imgspotlight varchar(255) NOT NULL default ' ' ");
        
//add some messages?
    
}
    
    
//add field in stories table for text for img credits
    
if (!FieldExists('imgspotlightdesc',$xoopsDB->prefix('stories'))) {
    
$result $xoopsDB->query("ALTER TABLE ".$xoopsDB->prefix('stories')." ADD imgauthor varchar(255) NOT NULL default ' ' ");
        
//add some messages?
    
}
}

function 
FieldExists($fieldname,$table)
{
    global 
$xoopsDB;
    
$result=$xoopsDB->queryF("SHOW COLUMNS FROM    $table LIKE '$fieldname'");
    return(
$xoopsDB->getRowsNum($result) > 0);
}


spent like an hour trying to figure out whats wrong.. any help would be great..
CBB / LatestNews / Publisher / XM-Spotlight

(ノ◕ヮ◕)ノ*:・゚✧

2
Mithrandir
Re: man whats wrong with my oninstall function.?

Is the function not called correctly?
Or doesn't it perform the changes?
What does PHP/MySQL debug say?
"When you can flatten entire cities at a whim, a tendency towards quiet reflection and seeing-things-from-the-other-fellow's-point-of-view is seldom necessary."

Cusix Software

3
iHackCode
Re: man whats wrong with my oninstall function.?

Quote:

Mithrandir wrote:
Is the function not called correctly?
Or doesn't it perform the changes?
What does PHP/MySQL debug say?


- I dont Think its being called.
- I Noticed The Changes Are Not Made
- And There Are No Errors And Also.. Queries Didnt Have Any Entries For Alter Table. (when i install the module)

Module Is XM-Spotlight (Directory 'xmspotlight'). Im Trying To Make An oninstall function but... im not successful.
CBB / LatestNews / Publisher / XM-Spotlight

(ノ◕ヮ◕)ノ*:・゚✧

4
Mithrandir
Re: man whats wrong with my oninstall function.?

any PHP errors about failing to open a file?

Note that the file specified in $modversion is relative to the module's root folder, so the file oninstall.php should reside in /modules/xmspotlight/

Also note that the array index is case sensitive, so try changing it to
$modversion['onInstall'] = "oninstall.php";
(capital I in onInstall)

PS: Your capitalisation of each word is enormously disrupting for the readability
"When you can flatten entire cities at a whim, a tendency towards quiet reflection and seeing-things-from-the-other-fellow's-point-of-view is seldom necessary."

Cusix Software

5
iHackCode
Re: man whats wrong with my oninstall function.?

Quote:

Mithrandir wrote:
any PHP errors about failing to open a file?

Note that the file specified in $modversion is relative to the module's root folder, so the file oninstall.php should reside in /modules/xmspotlight/

Also note that the array index is case sensitive, so try changing it to
$modversion['onInstall'] = "oninstall.php";
(capital I in onInstall)



Thanks Mith.. it was the i in onInstall i didn't notice that its supposed to be capitalized..

Quote:
PS: Your capitalisation of each word is enormously disrupting for the readability


Its A Bad Habit..
CBB / LatestNews / Publisher / XM-Spotlight

(ノ◕ヮ◕)ノ*:・゚✧

Login

Who's Online

219 user(s) are online (131 user(s) are browsing Support Forums)


Members: 0


Guests: 219


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits