1
AWDMolitov
Dropping SQLTable on uninstall?

Hello all.

I'm making my own module for XOOPS, but am getting stuck on dropping a table on uninstall, can someone help me on this :)

thank-you
Molitov

2
Dave_L
Re: Dropping SQLTable on uninstall?
  • 2006/5/7 10:17

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


The tables specified in your module's xoops_version.php automatically get added during install and dropped on uninstall:

$modversion['tables'][0] = 'modulename_table1';
$modversion['tables'][1] = 'modulename_table2';
...

Is that not working for your module?

3
AWDMolitov
Re: Dropping SQLTable on uninstall?
  • 2006/5/7 10:21

  • AWDMolitov

  • Just popping in

  • Posts: 23

  • Since: 2005/8/14


ahhh!

I was just using $modversion['sqlfile']['mysql'] = "sql/mysql.sql";
with the sql information in the sql file.

Thanks :)
Just learning how to make modules by copying other modules i use :)

4
AWDMolitov
Re: Dropping SQLTable on uninstall?
  • 2006/5/11 14:04

  • AWDMolitov

  • Just popping in

  • Posts: 23

  • Since: 2005/8/14


another question, but not on dropping tables,

updating them this time....
i currently have this code:
<?php

//Meta Redirect
echo "<head>";
echo 
"<meta http-equiv='Refresh' content='5;url=index.php'>";
echo 
"</head>";

//Get XOOPS Stuff
include "../../../include/cp_header.php";
xoops_cp_header();

//Retrieve Data from Form
$cid = $_POST['cid'];
$pic = $_POST['pic'];

//Set MySQL Table
$table = $xoopsDB->prefix( "bf2stats" ) ;

//Update Table
if (isset($cid)) {
    
$xoopsDB->query("UPDATE `$table` SET `cid` = '$cid', `pic` = '$pic' WHERE `wid` = '1' LIMIT 1");
    }
if (empty(
$cid)) {
    
$cid = "Value Empty!";
    
$emp = "1";
}
if (empty(
$pic)) {
    
$pic = "Value Empty!";
        
$emp = "1";
}
OpenTable();
?>
<p align="center">Battlefield 2 Stats Supplied By bf2tracker.com</p>
<p align="center">You will be redirected back to the main page in 5 seconds.<br>
  <?php
  
echo "$pic" ;
  echo 
"$cid" ;
?>
  <br>
                        <?php
            
if ($emp === '1') { echo "<font color='red'>Database Was Not Updated because one or more         

        variables are missing.</font>"
; }
            if (empty(
$emp)) { echo "<font color='green'>Database Was successfully updated.</font>"; }
            
?>
</p>
<p align="center">
<div align="center">
    <table border="0" width="50%" id="table1" cellspacing="0" cellpadding="0">
        <tr>
            <td width="50%"><p align="right">BF2  Tracker Clan ID
<br>
</td>
                <td>
                <p align="center"><?php echo $cid ?></td>
      </tr>
                <tr>
                <td width="50%">
                    <p align="right">Display Pictures on Side</td>
                    <td>
                      <p align="center">
                        <?php echo $pic ?>
                  </td></td>
      </tr>
                    <tr>
                        <td width="50%">&nbsp;</td>
                        <td>&nbsp;</td>
                    </tr>
    </table>
<?php
CloseTable
();
xoops_cp_footer(); 
?>

Now i know the data gets to it from the other form, and it all works, except it doesn't update the database.

Any Ideas?

5
m0nty
Re: Dropping SQLTable on uninstall?
  • 2006/5/11 15:55

  • m0nty

  • XOOPS is my life!

  • Posts: 3337

  • Since: 2003/10/24


turn on MySQL debug and see what happens when u submit..

also u might need to add global $xoopsDB; to the beginning of the script..