Code

docteursas Messages postés 33 Date d'inscription lundi 25 juillet 2005 Statut Membre Dernière intervention 13 mars 2011 - 16 févr. 2011 à 16:09
phpAnonyme Messages postés 392 Date d'inscription mercredi 28 octobre 2009 Statut Membre Dernière intervention 23 mars 2012 - 16 févr. 2011 à 21:31
bonjour à tous,
j'ai un problème avec un code qui marchait normallement. J'ai changé de serveur voici le message que j'ai quand j'exécute la page:
__________________________________________
Fatal error: Call to undefined method tNG_multiple::tNG_multiple() in /home/polarisc/public_html/includes/tng/tNG_multipleInsert.class.php on line 42
__________________________________________
voici le code à la ligne 42:
parent::tNG_multiple($connection);

Merci pour votre aide

docteur

3 réponses

phpAnonyme Messages postés 392 Date d'inscription mercredi 28 octobre 2009 Statut Membre Dernière intervention 23 mars 2012 55
16 févr. 2011 à 18:51
lut,

Ben le message est dans l'erreur ! La méthode tNG_multiple() n'est pas définie dans la classe multiple.


______________________________________________________________________
0
docteursas Messages postés 33 Date d'inscription lundi 25 juillet 2005 Statut Membre Dernière intervention 13 mars 2011
16 févr. 2011 à 19:05
voici mon code, il marchait bien sur l'ancien serveur, sur le nouveau il envoie un message d'erreur. voici le code de la page

<?php



class tNG_multipleInsert extends tNG_multiple {

var $insertElements;

var $executeSubSets;



function tNG_multipleInsert(&$connection) {
parent::tNG_multiple($connection);
$this->transactionType = '_multipleInsert';
$this->setInsertElements("GET","no_new");
$this->exportRecordset = true;
}



function setInsertElements($method, $reference) {
$tmp = KT_getRealValue($method, $reference);
if (is_null($tmp)) {
$tmp = 1;
} elseif ($tmp >20) {
$tmp = 20;
}
$this->insertElements = $tmp;
}


function prepareSQL() {
tNG_log::log('tNG_multipleInsert', 'prepareSQL', 'begin');
$ret = null;
$this->noSuccess = 0;
$failed = false;
for ($i=1;true;$i++) {
$tmp = KT_getRealValue("POST", $this->pkName . "_" . $i);
if (!isset($tmp)) {
break;
}
$this->multTNGs[$i-1] = new tNG_insert($this->connection);
$this->multTNGs[$i-1]->setDispatcher($this->dispatcher);
$this->multTNGs[$i-1]->multipleIdx = $i;
// register triggers
for ($j=0;$j<sizeof($this->multTriggers);$j++) {
call_user_func_array(array(&$this->multTNGs[$i-1], "registerConditionalTrigger"), $this->multTriggers[$j]);
}
// add columns
$this->multTNGs[$i-1]->setTable($this->table);
foreach($this->columns as $colName=>$colDetails) {

if ($colDetails['method'] == 'VALUE') {
$reference = $colDetails['reference'];
$value = KT_getRealValue($colDetails['method'], $colDetails['reference']);
} else {
$reference = $colDetails['reference'] . "_" . $i;
$value = KT_getRealValue($colDetails['method'], $colDetails['reference'] . "_" . $i);
if (!isset($value)) {
$reference = $colDetails['reference'];
$value = KT_getRealValue($colDetails['method'], $colDetails['reference']);
}
}

$this->columns[$colName]['value'] = $value;
$this->multTNGs[$i-1]->addColumn($colName, $colDetails['type'], $colDetails['method'], $reference, $colDetails['default']);
}
$this->multTNGs[$i-1]->setPrimaryKey($this->primaryKey, $this->primaryKeyColumn['type']);

$this->multTNGs[$i-1]->compileColumnsValues();

if ($this->getError()) {
$this->multTNGs[$i-1]->setError($this->getError());
}

$this->multTNGs[$i-1]->setStarted(true);
$this->multTNGs[$i-1]->doTransaction();

if ($this->multTNGs[$i-1]->getError()) {
$sw = $this->multTNGs[$i-1]->wereValuesSubmitted();
if ($sw) {
$failed = true;
} else {
if ($i!=1) {
// if there was an unival error on one of the 2nd-to-last inserts, ignore it.
$this->multTNGs[$i-1]->setError(null);
}
}
} else {
$this->noSuccess++;
$this->primaryKeyColumn['value'] = $this->multTNGs[$i-1]->getPrimaryKeyValue();
}
}
if ($this->noSuccess == 0) {
$failed = true;
}
if ($failed) {
$ret = new tNG_error('MINS_ERROR', array(), array());
if ($this->executeSubSets === false) {
for ($i=0;$i<sizeof($this->multTNGs);$i++) {
if (!$this->multTNGs[$i]->getError()) {
$this->multTNGs[$i]->setError($ret);
$this->multTNGs[$i]->executeTriggers('ERROR');
}
}
}
}
if ($this->executeSubSets === false) {
$this->noSuccess = 0;
}
tNG_log::log('tNG_multipleInsert', 'prepareSQL', 'end');
return $ret;
}


function getLocalRecordset() {
//Transaction was not started, use the default values
$fakeArr = array();
$tmpArr = $this->columns;
$fakeRs = array();
if (!isset($tmpArr[$this->primaryKey])) {
$tmpArr[$this->primaryKey] = $this->primaryKeyColumn;
$tmpArr[$this->primaryKey]['default'] = NULL;
}
foreach($tmpArr as $colName=>$colDetails) {
$tmpVal = KT_escapeForSql($colDetails['default'], $colDetails['type'], true);
$fakeArr[$colName] = $tmpVal;
}
for ($i=0;$i<$this->insertElements;$i++) {
$fakeArr[$this->pkName] = "KT_NEW";
$fakeRs[$i] = $fakeArr;
}
return $this->getFakeRecordset($fakeRs);
}


function addColumn($colName, $type, $method, $reference, $defaultValue = '') {
parent::addColumn($colName, $type, $method, $reference);
if ($method == "VALUE") {
$this->columns[$colName]['default'] = $reference;
} else {
$this->columns[$colName]['default'] = $defaultValue;
}
}



function saveData() {
return;
}
}
?>

docteur
0
phpAnonyme Messages postés 392 Date d'inscription mercredi 28 octobre 2009 Statut Membre Dernière intervention 23 mars 2012 55
16 févr. 2011 à 21:31
La méthode tNG_multiple() n'est pas définie dans la classe multiple par héritage de la classe tNG_multiple


______________________________________________________________________
0
Rejoignez-nous