<div dir="ltr">Hi <br><br>There may be a duplicate values you are trying to insert into the table.The below code may help you , Please check it.<br><br><blockquote><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">include_once 'include/utils/utils.php'; <br>include_once 'vtlib/Vtiger/Module.php';<br>require_once 'includes/Loader.php';<br><br>$proInstance = Vtiger_Module_Model::getInstance('Leads'); <br>if($proInstance){ <br>$fieldInstance = Vtiger_Field_Model::getInstance('Leads', $proInstance); <br> if ($proInstance !== false && !$fieldInstance) {<br> <br> $blockInstance = new Vtiger_Block();<br> $blockInstance->label = 'LBL_TEST_PICKLIST';<br> $proInstance->addBlock($blockInstance);<br> $field = new Vtiger_Field();<br> $field->name = 'test_picklist_field';<br> $field->label = 'Test Picklist Field';<br> $field->uitype = 16;<br> $field->typeofdata = 'I~O';<br> <br> $field->setPicklistValues( Array ('Value1', 'Value2') );<br> $blockInstance->addField($field);<br> echo "<br>Picklist of UItype 16 is added to contact";<br> }<br>}<br></blockquote><div><br><br></div><div>Regards,<br></div><div>Manu Urs <br></div></blockquote></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jul 28, 2015 at 5:27 PM, Kevin Alderton <span dir="ltr"><<a href="mailto:lists.k.j.alderton@gmail.com" target="_blank">lists.k.j.alderton@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
Hi,<br>
<br>
In the vtiger logs I am getting the following:<br>
<blockquote><cite>INFO VT - PearDatabase ->ADODB error Query
Failed:INSERT INTO vtiger_testpicklist (testpicklist id,
testpicklist , sortorderid, presence)
VALUES(?,?,?,?)::->[1064]You have an error in your SQL
syntax; check the manual that corresponds to your MySQL server
version for the right syntax to use near 'id, testpicklist ,
sortorderid, presence) VALUES(0,'Value2',2,1)' at line 1<br>
<br>
</cite></blockquote>
<cite>Is this a bug???????</cite><div><div class="h5"><cite></cite><br>
<cite></cite><br>
<br>
<br>
<br>
<br>
<br>
<br>
Hello,<br>
<br>
I am having trouble with vtlib and vtiger 6.3.<br>
<br>
I am trying to add a picklist field in the Leads module. <br>
<br>
All is well except no values are stored in the database nor table
inserted. Having tried three new instances of vtiger I am now
wondering if there has been an alteration in vtlib for 6.x. It
maybe something that I am missing. Has anyone had anything similar?<br>
<br>
My code is:<br>
<br>
<blockquote><?php<br>
<br>
include_once('vtlib/Vtiger/Module.php'); <br>
include_once('vtlib/Vtiger/Utils.php');<br>
<br>
$module = Vtiger_Module::getInstance('Leads'); <br>
<br>
$blockInstance = new vtiger_block();<br>
<br>
$blockInstance->label = 'LBL_TEST_PICKLIST';<br>
$module ->addBlock($blockInstance);<br>
<br>
$fieldInstance = new Vtiger_Field();<br>
$fieldInstance->name = 'test_picklist_field '; <br>
$fieldInstance->label = 'Test Picklist Field'; <br>
$fieldInstance->column = 'test_picklist_field';<br>
$fieldInstance->columntype = 'VARCHAR(50)';<br>
$fieldInstance-> table = $module->basetable;<br>
$fieldInstance->uitype = 16; <br>
$fieldInstance->typeofdata = 'V~O'; <br>
$blockInstance->addField($fieldInstance); <br>
echo "Added field <br />";<br>
$fieldInstance->setPicklistValues( Array ('Value1', 'Value2')
);<br>
<br>
Tia<br>
</blockquote>
</div></div></div>
<br>_______________________________________________<br>
<a href="http://www.vtiger.com/" rel="noreferrer" target="_blank">http://www.vtiger.com/</a><br></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature"><div dir="ltr"><div>Regards,<br></div>Manu<br></div></div>
</div>