vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   Product give error message (https://vborg.vbsupport.ru/showthread.php?t=233079)

vietfancy 01-14-2010 11:10 AM

Product give error message
 
I'm not sure what causes it. The first time it go though, but when i re-imported the code, it gives me error , but if I change the productid to something else then it will go through.

Here is the database error message.

Code:

                        UPDATE template SET
                                styleid = -10
                        WHERE product = 'ese_scholarship' AND styleid = -1;

MySQL Error  : Duplicate entry 'ese_scholarship--10-template' for key 'title'


and here is the product code:

PHP Code:

<?xml version="4.0" encoding="utf-8"?>
<product productid="ese_scholarship" active="1">
    <title>ESE Scholarship</title>
    <description>ESE scholarship</description>
    <version>4.0</version>
    <url />
    <versioncheckurl />
    <dependencies>
    </dependencies>
    <codes>
        <code version="4.0">
            <installcode><![CDATA[$db->query("CREATE TABLE IF NOT EXISTS `" . TABLE_PREFIX . "ese_scholarship` (                                               `id` int(4) unsigned NOT NULL AUTO_INCREMENT,
                          `donor` varchar(120) NOT NULL,
                          `amount` varchar(100) NOT NULL,
                          `fee` varchar(10) NOT NULL,
                          `month` varchar(10) NOT NULL,
                          `date` varchar(20) NOT NULL,
                          `year` varchar(4) NOT NULL,
                          PRIMARY KEY (`id`)
                          ) ENGINE=MyISAM");
$db->show_errors();]]></installcode>
            <uninstallcode><![CDATA[$db->query_write("DROP TABLE IF EXISTS `" . TABLE_PREFIX . "ese_scholarship`");
$db->show_errors();]]></uninstallcode>
        </code>
    </codes>
    <templates>
    <template name="ese_scholarship" templatetype="template" date="1260504996" username="JK" version="1.0">
    <![CDATA[{vb:stylevar htmldoctype}
<html xmlns="http://www.w3.org/1999/xhtml" dir="{vb:stylevar textdirection}" lang="{vb:stylevar languagecode}" id="vbulletin_html">
  <head>
    <title>ESE Scholarship - {vb:raw vboptions.bbtitle}</title>
    {vb:raw headinclude}
    <style type="text/css">
.ese_extra_top{
    width:100%;
    font-weight:bolder;
        text-align:center;
}
.ese_extra{
    width:100%;
    height:30px;
}
    .tname{
        width:20%;
        text-align:center;
    }
    .tfee{
        width:15%;
        text-align:center;
    }
    .tamount{
        width:17%;
        text-align:center;    
    }
    .tdate{
        width:15%;
        text-align:center;    
    }
    .ttotal{
        width:15%;
        text-align:center;
    }
    .sname{
    border-bottom: 1px solid #5a7f97;
        width:20%;
        text-align:center;
    }
    .sfee{
    border-bottom: 1px solid #5a7f97;
        width:15%;
        text-align:center;
    }
    .samount{
    border-bottom: 1px solid #5a7f97;
        width:17%;
        text-align:center;    
    }
    .sdate{
    border-bottom: 1px solid #5a7f97;
        width:15%;
        text-align:center;    
    }
    .stotal{
    border-bottom: 1px solid #5a7f97;
        width:15%;
        text-align:center;
        color:#C00;
    }


    .atname{
        width:20%;
        text-align:center;
    }
    .atdate{
        width:20%;
        text-align:center;    
    }
    .atfee, .atamount, .attotal, .atcp{
        width:12%;
        text-align:center;
    }


    .aname{
    border-bottom: 1px solid #5a7f97;
        width:20%;
        text-align:center;
    }
    .adate{
    border-bottom: 1px solid #5a7f97;
        width:20%;
        text-align:center;    
    }
    .afee{
    border-bottom: 1px solid #5a7f97;
        width:12%;
        text-align:center;
    }
    .aamount{
    border-bottom: 1px solid #5a7f97;
        width:12%;
        text-align:center;    
    }

    .atotal{
    border-bottom: 1px solid #5a7f97;
        width:12%;
        text-align:center;
        color:#C00;
    }
    .acp{
    border-bottom: 1px solid #5a7f97;
        width:12%;
        text-align:center;
    }
    </style>
  </head>
  <body>
    {vb:raw header}
    {vb:raw navbar}
<!-- Custom Code -->
<div style="padding:10px;"></div>
<vb:if condition="$ese_scholarship['do'] == 'add'">
    <h2 class="blockhead">Add A Donor to the Database</h2>
    <div class="blockbody"><div class="blockrow">
<vb:if condition="is_member_of($bbuserinfo, 6)"> 
<!-- start add form -->
<form action="scholarship.php?do=added"  method="post">
<input type="hidden" name="s" value="value" />
<input type="hidden" name="securitytoken" value="{vb:raw bbuserinfo.securitytoken}" />
<table class="tborder" cellpadding="0" cellspacing="6" border="0" width="100%" align="center">
    <tr valign="top">
        <td class="alt1" width="120" align="left" nowrap="nowrap">
        <div style="padding:4px;">Month / Date / Year:</div>
        <div style="padding:4px;">Donor:</div>
        <div style="padding:4px;">Base Amount:</div>
        <div style="padding:4px;">Transfer Fee:</div>
        </td>
        <td class="alt2" width="35%">
        <div style="padding:3px;"><SELECT  name="month">
                <option disabled selected>Month</option>
                <OPTION value="Jan">January</OPTION>
                <OPTION value="Feb">February</OPTION>
                <OPTION value="Mar">March</OPTION>
                <OPTION value="Apr">April</OPTION>
                <OPTION value="May">May</OPTION>
                <OPTION value="Jun">June</OPTION>
                <OPTION value="Jul">July</OPTION>
                <OPTION value="Aug">August</OPTION>
                <OPTION value="Sept">September</OPTION>
                <OPTION value="Oct">Octorber</OPTION>
                <OPTION value="Nov">November</OPTION>
                <OPTION value="Dec">December</OPTION>
                </SELECT> / 
                <SELECT  name="date">
                <option disabled selected>Date</option>
                <OPTION value="01">01</OPTION>
                <OPTION value="02">02</OPTION>
                <OPTION value="03">03</OPTION>
                <OPTION value="04">04</OPTION>
                <OPTION value="05">05</OPTION>
                <OPTION value="06">06</OPTION>
                <OPTION value="07">07</OPTION>
                <OPTION value="08">08</OPTION>
                <OPTION value="09">09</OPTION>
                <OPTION value="10">10</OPTION>
                <OPTION value="11">11</OPTION>
                <OPTION value="12">12</OPTION>
                <OPTION value="13">13</OPTION>
                <OPTION value="14">14</OPTION>
                <OPTION value="15">15</OPTION>
                <OPTION value="16">16</OPTION>
                <OPTION value="17">17</OPTION>
                <OPTION value="18">18</OPTION>
                <OPTION value="19">19</OPTION>
                <OPTION value="20">20</OPTION>
                <OPTION value="21">21</OPTION>
                <OPTION value="22">22</OPTION>
                <OPTION value="23">23</OPTION>
                <OPTION value="24">24</OPTION>
                <OPTION value="25">25</OPTION>
                <OPTION value="26">26</OPTION>
                <OPTION value="27">27</OPTION>
                <OPTION value="28">28</OPTION>
                <OPTION value="29">29</OPTION>
                <OPTION value="30">30</OPTION>
                <OPTION value="31">31</OPTION>
                </SELECT> / 
                <SELECT  name="year">
                <option disabled selected>Year</option>
                <OPTION value="2010">2010</OPTION>
                <OPTION value="2011">2011</OPTION>
                <OPTION value="2012">2012</OPTION>
                <OPTION value="2013">2013</OPTION>
                <OPTION value="2014">2014</OPTION>
                <OPTION value="2016">2015</OPTION>
                <OPTION value="2016">2016</OPTION>
                </SELECT></div>
        <div style="padding:3px;"><input type="text" size="37" maxlength="256" name="donor" autocomplete="off" /></div>
        <div style="padding:3px;"><input type="text" size="37" maxlength="256" name="amount" autocomplete="off" /></div>
        <div style="padding:3px;"><input type="text" size="37" maxlength="256" name="fee" autocomplete="off" /></div>
        </td>
        <td class="alt1" width="65%" align="left" nowrap="nowrap">
        <div style="padding:3px;">text go here</div>

        </td>
    </tr>
    <tr valign="top">
        <td class="alt2" colspan="3" width="100%" align="center" style="padding-top:20px;">
        <input type="submit" class="button" value="Submit" accesskey="s" />
        <input type="reset" class="button" value="Reset" accesskey="s" />
        </td>
    </tr>
</table>
</form>
<!-- end add form -->
<!-- End Custom Code -->
<vb:else />
     <div class="alert">You don't have permission to access this page.</div>
</vb:if>
      </div></div>
<vb:else />
<!-- START ESE DONATE -->
<h2 class="blockhead"><b>Donation Options</b></h2>
<div class="blockbody"><div class="blockbody">
<table class="ese_extra"><tr>
<td style="padding:10px;" width="50%" ><ul>
  <li><strong>Using Paypal:</strong><br/>
    1. You must have a paypal account to use this option.<br/>
    2. Paypal home page: <a href="http://www.paypal.com"> www.paypal.com</a><br/>
    <br/>
  </li></ul>
    <hr>
    1. You can go to <a href="http://www.paypal.com"> Paypal</a> and make a donation to <strong><font color="#FF0000">ESE.Scholarship@gmail.com</font></strong><br/>
    or<br/>
    2. You can just click on the button below to go to the donation page.<br/><br/>
    <div align="center">
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_donations">
<input type="hidden" name="business" value="ESE.Scholarship@gmail.com">
<input type="hidden" name="item_name" value="Make a donation to support ESE scholarship.">
<input type="hidden" name="no_shipping" value="0">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="tax" value="0">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="bn" value="PP-DonationsBF">
<input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but21.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>

    </div>
    </td>     
<td style="padding:10px;" width="50%">

<ul>
  <li><strong>By Mail:</strong><br/>
    1. Attach a note to inform us of who you are. Please use nick on Paltalk and/or in this forum. Please include your email address.<br/>
    2. If you wish to be anonymous, please state that in your note.<br/>
    <br/>
  </li></ul>

  <hr>

Mail a check or money order to the address given below:<br/>
<br/>
<strong>    <font color="#FF0000">ESE Scholarship<br/>
    c/o Nguyen<br/>
    P.O. BOX 90481<br/>
    San Jose, Ca 95109, USA</font><br/>
</strong></td>     
</tr>  
</table></div></div>
<!-- /END ESE DONATE -->

{vb:raw current_total}
<h2 class="blockhead"><b>ESE Scholarship Fund</b></h2>
<vb:if condition="$bbuserinfo[userid] == 1">
<div class="blocksubhead">{vb:raw ese_admin_fund_top}</div>
<div class="blockbody"><div class="blockrow">
{vb:raw ese_admin_fund}
</div></div>
<vb:else />
<div class="blocksubhead">{vb:raw ese_fund_top}</div>
<div class="blockbody"><div class="blockrow">
{vb:raw ese_fund}
</div></div>
</vb:if>
<!-- End Custom Code -->
</vb:if>
    {vb:raw footer}
  </body>
</html>]]>
    </template>
    </templates>
</product>


Vaupell 01-14-2010 05:02 PM

aparently the IF NOT EXISTS is not doing its job

$vbulletin->db->hide_errors();
$vbulletin->db->query_write("CREATE TABLE IF NOT EXISTS " . TABLE_PREFIX ."data_name
(id int(4) NOT NULL auto_increment, table1 varchar(120) NOT NULL, table2 varchar(100)NOT NULL, PRIMARY KEY (id))");
$vbulletin->db->show_errors();

thats how i would run the table..

but also noticed the install code version is 4.0
but your product code is 1.0

im quite sure the the product code needs to be same version or higher to run
the install code, other way around the product ignores the install code higher than
the product version.

try it, its not sure it will work since the IF NOT EXISTS dont check,
it should if the table exist then skip the step.

Paul M 01-14-2010 09:20 PM

The error has nothing to do with table creation, its a duplicate key error on updating a record in the template table.

Please post the actual product code, since what you posted above clearly isnt it.

vietfancy 01-15-2010 12:06 AM

actual code has updated. Thanks

vietfancy 01-17-2010 09:12 AM

could anyone helps? Thanks

Paul M 01-17-2010 11:37 AM

I cant see anything wrong with it, nor can i replicate your issue. I can import it multiple times with no errors.


All times are GMT. The time now is 04:44 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03346 seconds
  • Memory Usage 1,814KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete