Hello,
i have a form and i want to update data in my DB with the form’s data.
But i have this error in my log :
[code]UPDATE LIBRARY.ART SET ARTNUM=‘XXXX’,ARTDEP=‘100’ WHERE ARTNUM=‘XXXX’
exception ‘Exception’ with message 'PDO - sql execution failed
Table ART de LIBRARY incorrecte pour cette opération.[/code]
But if i take this reques and i use it directly on the server, it works…
Here is my code :
form.html :
[code]
Test Formulaire<link rel="stylesheet" type="text/css" href="dhtmlxForm/dhtmlxForm/codebase/skins/dhtmlxform_dhx_skyblue.css">
<script src="dhtmlxGrid/dhtmlxDataProcessor/codebase/dhtmlxdataprocessor.js"></script>
<script src="dhtmlxForm/dhtmlxForm/codebase/dhtmlxcommon.js"></script>
<script src="dhtmlxForm/dhtmlxForm/codebase/dhtmlxform.js"></script>
<script src="dhtmlxForm/dhtmlxForm/codebase/ext/dhtmlxform_item_calendar.js"></script>
<script src="dhtmlxGrid/dhtmlxCalendar/codebase/dhtmlxcalendar.js"></script>
<link rel="stylesheet" type="text/css" href="dhtmlxGrid/dhtmlxCalendar/codebase/dhtmlxcalendar.css">
<link rel="stylesheet" type="text/css" href="dhtmlxGrid/dhtmlxCalendar/codebase/skins/dhtmlxcalendar_dhx_skyblue.css">
var myForm, formData;
function doOnLoad() {
formData = [
{type: "fieldset", name:"form", label:"Recherche d'article", list:[
{type: "input", name: 'ARTNUM', label: 'Article:', position: 'label-top',disabled:'', value:'', required:''},
{type: "input", name: 'ARTDEP', label: 'Stock reel:', position: 'label-top', width : 100},
{type:"button", name:"OK", width:150, value:"Valider"},
{type:"button", name:"Cancel", width:150, value:"Retour"}, ]}];
myForm = new dhtmlXForm("form_container", formData);
myForm.load("connection/pdo.php?id=XXXX");
var dp = new dataProcessor("php/dataUP.php");
dp.init(myForm);
myForm.attachEvent("onButtonClick", function(name){
window[name]();
});
}
function OK() {
myForm.save();
}
function Cancel(){
}
</script>
[/code]
dataUP.php :
[code]<?php
$options = array ();
$options[‘i5_naming’] = true ;
$options[‘i5_libl’] = array() ;
$options[‘DB2_ATTR_CASE’] = ‘UPPER’ ;
require_once ‘…/dhtmlxConnector/codebase/dataprocessor.php’;
require_once ‘…/dhtmlxConnector/codebase/form_connector.php’;
require_once ‘…/dhtmlxConnector/codebase/db_pdo.php’;
$ipa = ‘*LOCAL’ ;
$usr = ‘DB2USER’ ;
$pwd = ‘PWD’ ;
$cnx_db01 = new pdo(‘ibm:*LOCAL’, $usr, $pwd, $options);
$form = new FormConnector($cnx_db01,“PDO”);
$form->enable_log(“db.log”);
$form->render_table(“LIBRARY.ART”,“ARTNUM”, “ARTNUM, ARTDEP”);
?>[/code]
pdo.php :
[code]<?php
$options = array ();
$options[‘i5_naming’] = true ;
$options[‘i5_libl’] = array() ;
$options[‘DB2_ATTR_CASE’] = ‘UPPER’ ;
require_once ‘…/dhtmlxConnector/codebase/dataprocessor.php’;
require_once ‘…/dhtmlxConnector/codebase/form_connector.php’;
require_once ‘…/dhtmlxConnector/codebase/db_pdo.php’;
$ipa = ‘*LOCAL’ ;
$usr = ‘DB2USER’ ;
$pwd = ‘PWD’ ;
$cnx_db01 = new pdo(‘ibm:*LOCAL’, $usr, $pwd, $options);
$form = new FormConnector($cnx_db01,“PDO”);
$form->enable_log(“db.log”);
$sql =“SELECT ARTNUM, ARTDEP FROM LIBRARY.ART”;
$form->render_sql($sql, “ARTNUM”, “ARTNUM, ARTDEP”);
?>[/code]
Thanks for the help.
P.S : I want to use data of my DB in a label’s value, what should I write ?
If the name of my data is LABEL_K :
{type: "label", name: 'LABEL_K', label: '',position: 'label-top'},
But the label still empty with this code.