:::

18-2 include/onUpdate.php

<?php

//ALTER TABLE `x233_contact` DROP `pic_type`

function xoops_module_update_tad_contact(&$module, $old_version) {
 
    if(chk1())    go_update1();
    if(chk2())    go_update2();
   
    return true;
}




function chk1(){
    global $xoopsDB;
    $sql="select * from ".$xoopsDB->prefix("contact")." where `pic_type`=''";
    $result=$xoopsDB->query($sql);
   
    if(empty($result)) return false;
    return true;
}


function go_update1(){
    global $xoopsDB;
    $sql="ALTER TABLE ".$xoopsDB->prefix("contact")." DROP `pic_type`";
    $xoopsDB->queryF($sql) or redirect_header(XOOPS_URL."/modules/system/admin.php?fct=modulesadmin",30,  mysql_error());
}




function chk2(){
    global $xoopsDB;
    $sql="select `counter` from ".$xoopsDB->prefix("contact");
    $result=$xoopsDB->query($sql);
   
    if(empty($result)) return true;
    return false;
}


function go_update2(){
    global $xoopsDB;
    $sql="ALTER TABLE ".$xoopsDB->prefix("contact")." ADD `counter` SMALLINT UNSIGNED NOT NULL";
    $xoopsDB->queryF($sql) or redirect_header(XOOPS_URL."/modules/system/admin.php?fct=modulesadmin",30,  mysql_error());
}


?>


:::

搜尋

QR Code 區塊

https%3A%2F%2Fwww.tad0616.net%2Fmodules%2Ftad_book3%2Fpage.php%3Ftbsn%3D5%26tbdsn%3D176

書籍目錄

展開 | 闔起

線上使用者

17人線上 (7人在瀏覽線上書籍)

會員: 0

訪客: 17

更多…