Forums

DELETE dont see existing roww in chronoform before email

gwadawone 25 Apr, 2012
Hello, iam using a function to DELETE à row in a table.
I use à class for access to the database.

// Class----------------- 
class sql_ourfamily{ 
  ... 
  ... 
  function open( $id='defaut' ){ 
    global $in; 
    $in[$id] = mysql_connect($this->hote, $this->user, $this->pass) or die (mysql_error()); 
  } 


  function close( $id='defaut' ){ 
    global $in; 
    mysql_close($in[$id]); 
  } 

  function query( $req, $base='', $id='defaut' ){ 
    global $in; 
    $base = empty( $base ) ? $this->base : $base; 
    $db = mysql_select_db($base, $in[$id]) or die (mysql_error()); 
    $res = mysql_query( $req ) or die (mysql_error()); 

    print "<br>Affectés".mysql_affected_rows(); 

    return $res; 
  } 
} 


// Openning database------------------------------------------- 

$sql_fam= new sql_ourfamily(); 
$sql_fam->open(); 

// Function for Delete----------------------------------- 
function delete_personne($id_personne){ 
  global $sql_fam, $MESSAGE, $message, $javas, $redir0, $redirerr; 

  $requete = "DELETE FROM f90ul_chronoforms_data_proches WHERE cf_id='$id_personne'"; 
  $result=$sql_fam->query($requete); 
  if ($result){ 
    $message.= $MESSAGE['24']; 
    $javas = $redir0;	
  } 
  else{ 
    $message.= $MESSAGE['21']; 
    $javas = $redirerr;	
  } 

  return; 
}


Now the problem is that the function dont see an existing row checked with a SELECT just before and return a ressource $result but the mysql_affected_rows() = 0.

The request ($requete) executed directly in PHPmyAdmin works perfectly.

This function works in an other case.

I have worked on the subject for days and i dont see the differenec between the case where it works and the case where it does not.

It seems that when i use the custom code before email for validation the update is not done. When i take the code outside the chronoform form and use an external program called thru a button and not a submit in the chronoform code for the form, the update is done.

I would appreciate some advise or knowledge about this subject.

Bests regards
GreyHead 25 Apr, 2012
Hi gwadawone,

Why are you using your own database class and not the Joomla! one? I'm afraid that with that part you are on your own.

There's nothing here that calls your delete function which makes it difficult to see what is happening with that part either.

Bob
gwadawone 25 Apr, 2012
Thanks for everyone

I ahave bypassed the problem.
Heavy but work.

Regards
This topic is locked and no more replies can be posted.